diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_logger.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test_logger.lua b/test/test_logger.lua new file mode 100644 index 0000000..66c190f --- /dev/null +++ b/test/test_logger.lua | |||
@@ -0,0 +1,22 @@ | |||
1 | require "llthreads".new([[ | ||
2 | require "string" | ||
3 | |||
4 | require "llthreads".set_logger(function(msg) | ||
5 | if type(msg) ~= 'string' then | ||
6 | print("ERROR! Invalid error message: ", msg) | ||
7 | os.exit(-2) | ||
8 | end | ||
9 | if not msg:find("SOME ERROR", nil, true) then | ||
10 | print("ERROR! Invalid error message: ", msg) | ||
11 | os.exit(-1) | ||
12 | end | ||
13 | print("Done!") | ||
14 | os.exit(0) | ||
15 | end) | ||
16 | |||
17 | error("SOME ERROR") | ||
18 | ]]):start():join() | ||
19 | |||
20 | print("ERROR! Logger has not been call!") | ||
21 | os.exit(-1) | ||
22 | |||