PageRenderTime 23ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/test-suite/lua/exception_partial_info_runme.lua

#
Lua | 12 lines | 10 code | 1 blank | 1 comment | 0 complexity | 669b00bc176ec9110f2caa52ce74e228 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. require("import") -- the import fn
  2. import("exception_partial_info") -- import code
  3. -- catch "undefined" global variables
  4. setmetatable(getfenv(),{__index=function (t,i) error("undefined global variable `"..i.."'",2) end})
  5. imp=exception_partial_info.Impl()
  6. -- trying to call throwing methods
  7. -- should fail
  8. assert(pcall(function() imp:f1() end)==false)
  9. assert(pcall(function() imp:f2() end)==false)