diff options
Diffstat (limited to 'Tools/LuaMacro/tests/run-tests.lua')
-rw-r--r-- | Tools/LuaMacro/tests/run-tests.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Tools/LuaMacro/tests/run-tests.lua b/Tools/LuaMacro/tests/run-tests.lua new file mode 100644 index 0000000..8bc3317 --- /dev/null +++ b/Tools/LuaMacro/tests/run-tests.lua @@ -0,0 +1,35 @@ +-- similar syntax to tests.bat, but more portable and aware of errors. +require_ 'forall' +require_ 'qw' +local lua52 = _VERSION:match '5.2' +local lua51 = not lua52 +def_ put io.stderr:write + +local tests = qw(dollar,lambda,try,block,forall,scope,do,const,with,case,mod,test,rawhash) + +local luam = lua51 and 'luam' or 'luam52' + +function run (f) + put(f,': ') + local res = os.execute(luam..' '..f) + if (lua52 and not res) or (lua51 and res ~= 0) then + put 'failed!\n' + os.exit(1) + else + put 'ok\n' + end +end + +forall f in tests do + f = 'test-'..f..'.lua' + run(f) +end + +run '-lcskin test-cskin.lua' + +if pcall(require,'pl') then + run 'test-list.lua' + run 'test-pl-list.lua' +end + + |