Use clearer file extensions for test files.

This commit is contained in:
Andy Stewart
2014-11-13 15:27:52 +01:00
parent 1f2bb48be5
commit e5add67b03
12 changed files with 12 additions and 8 deletions

2
.gitignore vendored
View File

@@ -1,3 +1,3 @@
/doc/tags /doc/tags
/misc /misc
/test/*.out /test/*.actual

View File

@@ -19,9 +19,9 @@ call Setup()
``` ```
- Run the tests. - Run the tests.
- Inspect output from the new test. If good, copy it to `foo.ok`. - Inspect output (in `foo.actual`) from the new test. If good, copy it to `foo.expected`.
- Run the tests to ensure new test's output is verified. - Run the tests to ensure new test's output is verified.
- `rm *.out` and commit changes. - Commit changes.
### Limitations ### Limitations

View File

@@ -9,11 +9,11 @@ function! Setup()
endfunction endfunction
function! DumpSigns(filename) function! DumpSigns(filename)
execute 'redir! > ' a:filename.'.out' execute 'redir! > ' a:filename.'.actual'
silent execute 'sign place' silent execute 'sign place'
redir END redir END
endfunction endfunction
function! DumpGitDiff(filename) function! DumpGitDiff(filename)
call system('git diff --staged fixture.txt > '.a:filename.'.out') call system('git diff --staged fixture.txt > '.a:filename.'.actual')
endfunction endfunction

View File

@@ -3,7 +3,8 @@
# TODO: exit with non-zero status code when tests fail. # TODO: exit with non-zero status code when tests fail.
rm -f *.out # Clean up.
rm -f *.actual
# Execute the tests. # Execute the tests.
for testcase in test*.vim; do for testcase in test*.vim; do
@@ -14,9 +15,9 @@ done
count_ok=0 count_ok=0
count_fail=0 count_fail=0
for expected in *.ok; do for expected in *.expected; do
name=${expected%.*} name=${expected%.*}
actual=$name.out actual=$name.actual
if diff $expected $actual; then if diff $expected $actual; then
count_ok=$((count_ok + 1)) count_ok=$((count_ok + 1))
@@ -27,9 +28,12 @@ for expected in *.ok; do
fi fi
done done
# Clean up.
git reset HEAD fixture.txt > /dev/null git reset HEAD fixture.txt > /dev/null
git checkout fixture.txt git checkout fixture.txt
rm -f *.actual
# Print results.
echo echo
echo "$((count_ok + count_fail)) tests" echo "$((count_ok + count_fail)) tests"
echo "$count_ok ok" echo "$count_ok ok"