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