diff options
author | Mark Pulford <mark@kyne.com.au> | 2011-11-29 22:55:54 +1030 |
---|---|---|
committer | Mark Pulford <mark@kyne.com.au> | 2011-11-29 22:55:54 +1030 |
commit | a5f6b3e2f9ed7eb6788bf6568c31746185bcfa86 (patch) | |
tree | abeacad12b1911ca9249310a0371715106ad7552 | |
parent | 630bb3f16f27c72e3fc2daf3161c96f0fd9c1ba0 (diff) | |
download | lua-cjson-a5f6b3e2f9ed7eb6788bf6568c31746185bcfa86.tar.gz lua-cjson-a5f6b3e2f9ed7eb6788bf6568c31746185bcfa86.tar.bz2 lua-cjson-a5f6b3e2f9ed7eb6788bf6568c31746185bcfa86.zip |
Add automated build testing (LuaRocks, Makefile)
-rwxr-xr-x | runtests.sh | 45 | ||||
-rwxr-xr-x | tests/test.lua | 2 |
2 files changed, 46 insertions, 1 deletions
diff --git a/runtests.sh b/runtests.sh new file mode 100755 index 0000000..1e0a5cd --- /dev/null +++ b/runtests.sh | |||
@@ -0,0 +1,45 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | MAKE=make | ||
4 | #MAKE=gmake | ||
5 | |||
6 | EGREP="grep -E" | ||
7 | #EGREP="egrep" | ||
8 | |||
9 | set -e | ||
10 | |||
11 | do_tests() { | ||
12 | echo | ||
13 | cd tests | ||
14 | ./test.lua | $EGREP 'version|PASS|FAIL' | ||
15 | cd .. | ||
16 | } | ||
17 | |||
18 | cat <<EOT | ||
19 | Please ensure you do not have the Lua CJSON module installed before | ||
20 | running these tests. | ||
21 | |||
22 | EOT | ||
23 | |||
24 | echo "===== Setting LuaRocks PATH =====" | ||
25 | eval "`luarocks path`" | ||
26 | |||
27 | echo "===== Building UTF-8 test data =====" | ||
28 | ( cd tests && ./genutf8.pl; ) | ||
29 | |||
30 | echo "===== Cleaning old build data =====" | ||
31 | $MAKE clean | ||
32 | rm -f tests/cjson.so | ||
33 | |||
34 | echo "===== Testing LuaRocks build =====" | ||
35 | luarocks make --local | ||
36 | do_tests | ||
37 | luarocks remove --local lua-cjson | ||
38 | $MAKE clean | ||
39 | |||
40 | echo "===== Testing Makefile build =====" | ||
41 | $MAKE | ||
42 | cp cjson.so tests | ||
43 | do_tests | ||
44 | $MAKE clean | ||
45 | rm -f tests/cjson.so | ||
diff --git a/tests/test.lua b/tests/test.lua index 02d3760..b7b50d2 100755 --- a/tests/test.lua +++ b/tests/test.lua | |||
@@ -221,7 +221,7 @@ local locale_tests = { | |||
221 | end | 221 | end |
222 | } | 222 | } |
223 | 223 | ||
224 | print(string.format("Testing CJSON v%s\n", cjson.version)) | 224 | print(string.format("Testing Lua CJSON version %s\n", cjson.version)) |
225 | 225 | ||
226 | run_test_group("decode simple value", decode_simple_tests) | 226 | run_test_group("decode simple value", decode_simple_tests) |
227 | run_test_group("encode simple value", encode_simple_tests) | 227 | run_test_group("encode simple value", encode_simple_tests) |