aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/error.lua18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/error.lua b/tests/error.lua
index a1ba1ce..243dd57 100644
--- a/tests/error.lua
+++ b/tests/error.lua
@@ -1,9 +1,19 @@
1-- 1--
2-- Error reporting 2-- Error reporting
3-- 3--
4local function PRINT(...)
5 local str=""
6 for i=1,select('#',...) do
7 str= str..tostring(select(i,...)).."\t"
8 end
9 if io then
10 io.stderr:write(str.."\n")
11 end
12end
13
4local which_tests, remaining_tests = {}, {} 14local which_tests, remaining_tests = {}, {}
5for k,v in ipairs{...} do 15for k,v in ipairs{...} do
6 print("got arg:", type(v), tostring(v)) 16 PRINT("got arg:", type(v), tostring(v))
7 which_tests[v] = true 17 which_tests[v] = true
8 remaining_tests[v] = true 18 remaining_tests[v] = true
9end 19end
@@ -27,7 +37,7 @@ local WR = function(...)
27 if type(v) == "function" then 37 if type(v) == "function" then
28 local infos = debug.getinfo(v) 38 local infos = debug.getinfo(v)
29 --[[for k,v in pairs(infos) do 39 --[[for k,v in pairs(infos) do
30 print(k,v) 40 PRINT(k,v)
31 end]] 41 end]]
32 v = infos.source..":"..infos.linedefined 42 v = infos.source..":"..infos.linedefined
33 end 43 end
@@ -115,7 +125,7 @@ local configure_tests = function()
115 (lane_error and tostring(lane_error) or "no error") .. " in lane", 125 (lane_error and tostring(lane_error) or "no error") .. " in lane",
116 (finalizer and "with" or "without").. " finalizer" .. ((finalizer and finalizer_error) and " raising " .. tostring(finalizer_error) or "") 126 (finalizer and "with" or "without").. " finalizer" .. ((finalizer and finalizer_error) and " raising " .. tostring(finalizer_error) or "")
117 }, ", ") 127 }, ", ")
118 print(test_header) 128 PRINT(test_header)
119 test_settings[test_header] = { level, lane_error, finalizer, finalizer_error } 129 test_settings[test_header] = { level, lane_error, finalizer, finalizer_error }
120 end 130 end
121 -- can't store nil in tables, use null instead 131 -- can't store nil in tables, use null instead
@@ -240,4 +250,4 @@ end
240local unknown_test, val = next(remaining_tests) 250local unknown_test, val = next(remaining_tests)
241assert(not unknown_test, tostring(unknown_test) .. " test is unknown") 251assert(not unknown_test, tostring(unknown_test) .. " test is unknown")
242 252
243print "\nTHE END" 253PRINT "\nTHE END"