PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Lua | 17 lines | 15 code | 1 blank | 1 comment | 0 complexity | ed6ddb5be6d21a94b0a6d87ae43199a7 MD5 | raw file
 1require("import")	-- the import fn
 2import("abstract_access")	-- import code
 3
 4-- catch "undefined" global variables
 5setmetatable(getfenv(),{__index=function (t,i) error("undefined global variable `"..i.."'",2) end})
 6
 7-- trying to instantiate pure virual classes
 8-- should fail
 9assert(pcall(abstract_access.A)==false)
10assert(pcall(abstract_access.B)==false)
11assert(pcall(abstract_access.C)==false)
12
13-- instantiate object
14d=abstract_access.D()
15
16--call fn
17assert(d:do_x()==1)