Skip to content

Commit bfefcff

Browse files
committed
add test/run_command.sh script for tlanslated vimlparser
It wil run the same test as test/run.vim for translated vimlparser command.
1 parent 2c7dedd commit bfefcff

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

test/run_command.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
if [ $# -eq 0 ]; then
4+
echo "USAGE: ./test/run_command.sh <vimlparser command>"
5+
echo " Example: ./test/run_command.sh python3 py/vimlparser.py"
6+
exit 1
7+
fi
8+
vimlparser=$@
9+
10+
exit_status=0
11+
12+
test_file() {
13+
local vimfile=$1
14+
local base=$(basename "$vimfile" ".vim")
15+
local okfile="test/${base}.ok"
16+
local outfile="test/${base}.out"
17+
18+
if [[ -f "test/${base}.skip" ]]; then
19+
return
20+
fi
21+
22+
local neovim=""
23+
if [[ $vimfile =~ "test_neo" ]]; then
24+
neovim="--neovim"
25+
fi
26+
27+
rm -f ${outfile}
28+
29+
${vimlparser} ${neovim} ${vimfile} &> ${outfile}
30+
31+
diffout=$(diff -u ${outfile} ${okfile})
32+
if [ -n "$diffout" ]; then
33+
exit_status=1
34+
echo "${diffout}"
35+
fi
36+
}
37+
38+
for f in test/test*.vim; do
39+
test_file ${f}
40+
done
41+
42+
exit $exit_status

0 commit comments

Comments
 (0)