local function mkerror(key) if key == "a" then error("test failed") elseif key == "b" then -- hello error("test failed") elseif key == "c" then error("test failed") elseif key == "d" then -- hmm... error("test failed") elseif key == "e" then -- hmm... error("test failed") elseif key == "f" then -- increasingly confused about this -- hmm... error("test failed") elseif key == "g" then local foo = [[ Test. Test. ]] error("test failed") end end local ok, msg = pcall(mkerror,"a") assert(not ok and msg:match(":3"), msg) local ok, msg = pcall(mkerror,"b") assert(not ok and msg:match(":6"), msg) local ok, msg = pcall(mkerror,"c") assert(not ok and msg:match(":10"), msg) local ok, msg = pcall(mkerror,"d") assert(not ok and msg:match(":13"), msg) local ok, msg = pcall(mkerror,"e") assert(not ok and msg:match(":17"), msg) local ok, msg = pcall(mkerror,"f") assert(not ok and msg:match(":21"), msg) local ok, msg = pcall(mkerror,"g") assert(not ok and msg:match(":27"), msg) print("line number tests pass")