Allow multiple expectations per test.

This commit is contained in:
Andy Stewart
2014-11-13 15:21:19 +01:00
parent 86cde1a919
commit dd054534a0
2 changed files with 9 additions and 13 deletions

View File

@@ -26,6 +26,5 @@ call Setup()
### Limitations
- Currently tests are done by writing out a file and comparing it to a known good one.
- Only 1 file per test is supported.
- There's no support for assertions within the testcase code.

View File

@@ -2,24 +2,20 @@
# TODO: exit with non-zero status code when tests fail.
canonicalise_test_name() {
local testname=$1 # testFoo.vim
name=${testname%.*} # testFoo
name=${name:4} # Foo
name="$(tr '[:upper:]' '[:lower:]' <<< ${name:0:1})${name:1}" # foo
}
rm -f *.out
# Execute the tests.
for testcase in test*.vim; do
vim -N -u NONE -S $testcase -c 'quit!'
done
# Verify the results.
count_ok=0
count_fail=0
for testcase in test*.vim; do
vim -N -u NONE -S $testcase -c 'quit!'
canonicalise_test_name $testcase
expected=$name.ok
for expected in *.ok; do
name=${expected%.*}
actual=$name.out
if diff $expected $actual; then
@@ -31,6 +27,7 @@ for testcase in test*.vim; do
fi
done
git reset HEAD fixture.txt > /dev/null
git checkout fixture.txt
echo