diff options
author | Tomas Guisasola <tomas@luaforge.net> | 2005-06-08 17:22:46 +0000 |
---|---|---|
committer | Tomas Guisasola <tomas@luaforge.net> | 2005-06-08 17:22:46 +0000 |
commit | 4c5778e2d0adacdd71e10696b4aa31ea34f1be66 (patch) | |
tree | 2abfe4c8109b0751e07e2055c39d3c37edb9819e | |
parent | Correcting Makefile to link against libldap.so. (diff) | |
download | lualdap-4c5778e2d0adacdd71e10696b4aa31ea34f1be66.tar.xz lualdap-4c5778e2d0adacdd71e10696b4aa31ea34f1be66.zip |
Enhancing error message when there is no connection.
Better output.
Diffstat (limited to '')
-rwxr-xr-x | lualdap/tests/test.lua | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lualdap/tests/test.lua b/lualdap/tests/test.lua index 034e7c9..299ed8e 100755 --- a/lualdap/tests/test.lua +++ b/lualdap/tests/test.lua @@ -6,7 +6,7 @@ -- renamed and deleted at the end. -- -- See Copyright Notice in license.html --- $Id: test.lua,v 1.13 2005-06-07 17:06:30 tomas Exp $ +-- $Id: test.lua,v 1.14 2005-06-08 17:22:46 tomas Exp $ --------------------------------------------------------------------- -- @@ -53,15 +53,16 @@ end -- checks for a value and throw an error if it is not the expected. --------------------------------------------------------------------- function assert2 (expected, value, msg) -io.write('.') if not msg then msg = '' else msg = tostring(msg)..'\n' end - return assert (value == expected, + local ret = assert (value == expected, msg.."wrong value (["..tostring(value).."] instead of ".. tostring(expected)..")") + io.write('.') + return ret end --------------------------------------------------------------------- @@ -84,7 +85,10 @@ function test_object (obj, objmethods) return obj end -CONN_OK = function (obj) +CONN_OK = function (obj, err) + if obj == nil then + error (err, 2) + end return test_object (obj, { "close", "add", "compare", "delete", "modify", "rename", "search", }) end @@ -124,11 +128,11 @@ end -- checks return value which should be a function AND also its return value. --------------------------------------------------------------------- function check_future (ret, method, ...) -io.write('.') local ok, f = pcall (method, unpack (arg)) assert (ok, f) assert2 ("function", type(f)) assert2 (ret, f()) + io.write('.') end |