diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-12-20 17:21:32 +0100 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-12-20 17:21:32 +0100 |
commit | 59ae58fd31d63c261372bd5a36765328583bc1b6 (patch) | |
tree | 44eef790bd9948d864db350746c4017a47d93e53 /tests | |
parent | 30579fc3e7c73bbad5d376c43f226b2c16c7cebb (diff) | |
download | lanes-59ae58fd31d63c261372bd5a36765328583bc1b6.tar.gz lanes-59ae58fd31d63c261372bd5a36765328583bc1b6.tar.bz2 lanes-59ae58fd31d63c261372bd5a36765328583bc1b6.zip |
Make VS Test Explorer happy by absorbing the text output of legacy tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/error.lua | 18 |
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 | -- |
4 | local 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 | ||
12 | end | ||
13 | |||
4 | local which_tests, remaining_tests = {}, {} | 14 | local which_tests, remaining_tests = {}, {} |
5 | for k,v in ipairs{...} do | 15 | for 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 |
9 | end | 19 | end |
@@ -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 | |||
240 | local unknown_test, val = next(remaining_tests) | 250 | local unknown_test, val = next(remaining_tests) |
241 | assert(not unknown_test, tostring(unknown_test) .. " test is unknown") | 251 | assert(not unknown_test, tostring(unknown_test) .. " test is unknown") |
242 | 252 | ||
243 | print "\nTHE END" | 253 | PRINT "\nTHE END" |