summaryrefslogtreecommitdiff
path: root/test/test_logger.lua
blob: f85a896a6eecaa9c9d97c0637e55f5c1f9547018 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
local utils = require "utils"

require "llthreads".new(utils.thread_init .. [[
require "string"

require "llthreads".set_logger(function(msg)
  if type(msg) ~= 'string' then
    print("ERROR! Invalid error message: ", msg)
    os.exit(-2)
  end
  if not msg:find("SOME ERROR", nil, true) then
    print("ERROR! Invalid error message: ", msg)
    os.exit(-1)
  end
  print("Done!")
  os.exit(0)
end)

error("SOME ERROR")
]]):start():join()

print("ERROR! Logger has not been call!")
os.exit(-1)