summaryrefslogtreecommitdiff
path: root/Tools/LuaMacro/tests/run-tests.lua
blob: 8bc3317d85ee2bc09259e563c72df480451da89c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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