github.com/hirochachacha/plua@v0.0.0-20170217012138-c82f520cc725/stdlib/base/testdata/error.lua (about) 1 ok, msg = pcall(error, "test", 1) 2 assert(not ok and msg == "test") 3 ok, msg = pcall(error, "test", 2) 4 assert(not ok and (msg == "testdata/error.lua:3: test" or msg == "testdata\\error.lua:3: test")) 5 ok, msg = pcall(error, "test", 3) 6 assert(not ok and msg == "test") 7 8 local function h() 9 error("test", 2) 10 end 11 12 local function g() 13 return h() 14 end 15 16 local function f() 17 g() 18 end 19 20 ok, msg = pcall(f) 21 assert(not ok and (msg == "testdata/error.lua:17: test" or msg == "testdata\\error.lua:17: test"))