]> git.lizzy.rs Git - metalua.git/blob - src/tests/run.mlua
dd2f3a28097b584b09de943f2847e73d8ab1dafa
[metalua.git] / src / tests / run.mlua
1 -- Run all *.lua and *.mlua files in this directory.
2 -- This makes it easy to run all tests in the directory, 
3
4 -{ extension 'xloop' }
5
6 ls = io.popen ( (os.getenv("OS") or "") :match "^Windows" and "dir /b" or "ls")
7 this_script = arg[1]
8
9 local errors = {}
10
11 for filename in ls :lines() if filename ~= this_script and filename :strmatch  "%.m?lua$" do
12    printf ("*** running %s ***", filename)
13    local ret = os.execute ("metalua "..filename)
14    if ret ~= 0 then 
15       errors[#errors + 1] = "Test "..filename.." failed, returned "..ret
16    end
17 end
18
19 ls :close()
20
21 if #errors > 0 then
22    print("\n\n================================================================================") 
23    error(
24       "TEST FAILURES DETECTED:\n" ..
25       "-----------------------\n" ..
26       " * " .. table.concat(errors, "\n * ")
27     ) 
28 end