From db7cb39cdd973deca26ad96d5a478a4ba1d98f30 Mon Sep 17 00:00:00 2001 From: Philipp Janda Date: Tue, 18 Aug 2015 00:49:22 +0200 Subject: assert() can handle non-string errors. --- tests/test.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'tests/test.lua') diff --git a/tests/test.lua b/tests/test.lua index 9ac27d4..7e9d57f 100755 --- a/tests/test.lua +++ b/tests/test.lua @@ -45,14 +45,25 @@ end package.path = "../?.lua;../?/init.lua;"..package.path package.cpath = "./?-"..V..".so;./?-"..V..".dll;./?.so;./?.dll" if mode == "module" then - print( "testing Lua API using `compat53.module` ..." ) + print("testing Lua API using `compat53.module` ...") _ENV = require("compat53.module") if setfenv then setfenv(1, _ENV) end else - print( "testing Lua API using `compat53` ..." ) + print("testing Lua API using `compat53` ...") require("compat53") end + +___'' +do + print("assert", F(pcall(assert, false))) + print("assert", F(pcall(assert, false, nil))) + print("assert", F(pcall(assert, false, "error msg"))) + print("assert", F(pcall(assert, nil, {}))) + print("assert", F(pcall(assert, 1, 2, 3))) +end + + ___'' do local t = setmetatable({}, { __index = { 1, false, "three" } }) -- cgit v1.2.3-55-g6feb