aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Pulford <mark@kyne.com.au>2011-11-29 22:55:54 +1030
committerMark Pulford <mark@kyne.com.au>2011-11-29 22:55:54 +1030
commita5f6b3e2f9ed7eb6788bf6568c31746185bcfa86 (patch)
treeabeacad12b1911ca9249310a0371715106ad7552
parent630bb3f16f27c72e3fc2daf3161c96f0fd9c1ba0 (diff)
downloadlua-cjson-a5f6b3e2f9ed7eb6788bf6568c31746185bcfa86.tar.gz
lua-cjson-a5f6b3e2f9ed7eb6788bf6568c31746185bcfa86.tar.bz2
lua-cjson-a5f6b3e2f9ed7eb6788bf6568c31746185bcfa86.zip
Add automated build testing (LuaRocks, Makefile)
-rwxr-xr-xruntests.sh45
-rwxr-xr-xtests/test.lua2
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
3MAKE=make
4#MAKE=gmake
5
6EGREP="grep -E"
7#EGREP="egrep"
8
9set -e
10
11do_tests() {
12 echo
13 cd tests
14 ./test.lua | $EGREP 'version|PASS|FAIL'
15 cd ..
16}
17
18cat <<EOT
19Please ensure you do not have the Lua CJSON module installed before
20running these tests.
21
22EOT
23
24echo "===== Setting LuaRocks PATH ====="
25eval "`luarocks path`"
26
27echo "===== Building UTF-8 test data ====="
28( cd tests && ./genutf8.pl; )
29
30echo "===== Cleaning old build data ====="
31$MAKE clean
32rm -f tests/cjson.so
33
34echo "===== Testing LuaRocks build ====="
35luarocks make --local
36do_tests
37luarocks remove --local lua-cjson
38$MAKE clean
39
40echo "===== Testing Makefile build ====="
41$MAKE
42cp cjson.so tests
43do_tests
44$MAKE clean
45rm -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
224print(string.format("Testing CJSON v%s\n", cjson.version)) 224print(string.format("Testing Lua CJSON version %s\n", cjson.version))
225 225
226run_test_group("decode simple value", decode_simple_tests) 226run_test_group("decode simple value", decode_simple_tests)
227run_test_group("encode simple value", encode_simple_tests) 227run_test_group("encode simple value", encode_simple_tests)