mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-09 03:53:47 -05:00
Allow multiple expectations per test.
This commit is contained in:
@@ -26,6 +26,5 @@ call Setup()
|
|||||||
### Limitations
|
### Limitations
|
||||||
|
|
||||||
- Currently tests are done by writing out a file and comparing it to a known good one.
|
- 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.
|
- There's no support for assertions within the testcase code.
|
||||||
|
|
||||||
|
|||||||
21
test/test.sh
21
test/test.sh
@@ -2,24 +2,20 @@
|
|||||||
|
|
||||||
# TODO: exit with non-zero status code when tests fail.
|
# 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
|
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_ok=0
|
||||||
count_fail=0
|
count_fail=0
|
||||||
|
|
||||||
for testcase in test*.vim; do
|
for expected in *.ok; do
|
||||||
vim -N -u NONE -S $testcase -c 'quit!'
|
name=${expected%.*}
|
||||||
|
|
||||||
canonicalise_test_name $testcase
|
|
||||||
expected=$name.ok
|
|
||||||
actual=$name.out
|
actual=$name.out
|
||||||
|
|
||||||
if diff $expected $actual; then
|
if diff $expected $actual; then
|
||||||
@@ -31,6 +27,7 @@ for testcase in test*.vim; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
git reset HEAD fixture.txt > /dev/null
|
||||||
git checkout fixture.txt
|
git checkout fixture.txt
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|||||||
Reference in New Issue
Block a user