diff options
Diffstat (limited to 'runtests.sh')
-rwxr-xr-x | runtests.sh | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/runtests.sh b/runtests.sh index 45b1b8c..f273385 100755 --- a/runtests.sh +++ b/runtests.sh | |||
@@ -1,17 +1,20 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | EGREP="grep -E" | ||
4 | |||
5 | PLATFORM="`uname -s`" | 3 | PLATFORM="`uname -s`" |
6 | 4 | ||
7 | [ "$PLATFORM" = "SunOS" ] && EGREP=egrep | ||
8 | |||
9 | set -e | 5 | set -e |
10 | 6 | ||
7 | # Portable "ggrep -A" replacement | ||
8 | # contextgrep PATTERN POST_MATCH_LINES | ||
9 | contextgrep() { | ||
10 | awk "/$1/ { count = ($2 + 1) } count { count--; print }" | ||
11 | } | ||
12 | |||
11 | do_tests() { | 13 | do_tests() { |
12 | echo | 14 | echo |
13 | cd tests | 15 | cd tests |
14 | ./test.lua | $EGREP 'version|PASS|FAIL' | 16 | lua -e 'require "cjson"; print("Testing Lua CJSON version " .. cjson.version)' |
17 | ./test.lua | contextgrep 'FAIL|Summary' 3 | grep -v PASS | cut -c -70 | ||
15 | cd .. | 18 | cd .. |
16 | } | 19 | } |
17 | 20 | ||