From 27d6efb5f5a076f825fe2da1875e0cabaf02b4e7 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 17 Nov 2021 23:03:07 +0800 Subject: + LuaMacro --- Tools/LuaMacro/tests/run-tests.lua | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Tools/LuaMacro/tests/run-tests.lua (limited to 'Tools/LuaMacro/tests/run-tests.lua') 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 + + -- cgit v1.1-26-g67d0