aboutsummaryrefslogtreecommitdiffstats
path: root/lualdap/tests/test.lua
diff options
context:
space:
mode:
authorTomas Guisasola <tomas@luaforge.net>2003-09-02 17:01:29 +0000
committerTomas Guisasola <tomas@luaforge.net>2003-09-02 17:01:29 +0000
commit83a88170de655cbb692cb9c77b3b42c9f1bb16c1 (patch)
treeb5442af0437b77810d66ff640613fc5b0886484a /lualdap/tests/test.lua
parentSubstituicao do arquivo lualdap.lua pelo loader.tmpl generico. (diff)
downloadlualdap-83a88170de655cbb692cb9c77b3b42c9f1bb16c1.tar.xz
lualdap-83a88170de655cbb692cb9c77b3b42c9f1bb16c1.zip
Correcao na funcao que espera mais uma mensagem quando a ultima mensagem
ja' foi recebida.
Diffstat (limited to 'lualdap/tests/test.lua')
-rwxr-xr-xlualdap/tests/test.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/lualdap/tests/test.lua b/lualdap/tests/test.lua
index 2213b45..3778a26 100755
--- a/lualdap/tests/test.lua
+++ b/lualdap/tests/test.lua
@@ -1,7 +1,7 @@
#!/usr/local/bin/lua
---------------------------------------------------------------------
-- LuaLDAP test file.
--- $Id: test.lua,v 1.6 2003-09-01 18:59:30 tomas Exp $
+-- $Id: test.lua,v 1.7 2003-09-02 17:01:29 tomas Exp $
-- This test will create a copy of an existing entry on the
-- directory to work on. This new entry will be modified,
-- renamed and deleted at the end.
@@ -104,7 +104,7 @@ function basic_test ()
-- trying to connect to an invalid host.
assert2 (nil, lualdap.open_simple ("unknown-server"), "this should be an error")
-- reopen the connection.
- LD = assert (lualdap.open_simple (HOSTNAME, WHO, PASSWORD, true))
+ LD = CONN_OK (lualdap.open_simple (HOSTNAME, WHO, PASSWORD, true))
CLOSED_LD = ld
end
@@ -224,15 +224,27 @@ function search_test_2 ()
-- checking filter.
local _,_, rdn_name, rdn_value, parent_dn = string.find (NEW_DN, DN_PAT)
local filter = string.format ("(%s=%s)", rdn_name, rdn_value)
- assert (count{ base = BASE, scope = "subtree", filter = filter, } == 1)
+ assert (count { base = BASE, scope = "subtree", filter = filter, } == 1)
-- checking sizelimit.
- assert (count{ base = BASE, scope = "subtree", sizelimit = 1, } == 1)
+ assert (count { base = BASE, scope = "subtree", sizelimit = 1, } == 1)
-- checking attrsonly parameter.
for dn, entry in LD:search { base = BASE, scope = "subtree", attrsonly = true, } do
for attr, value in pairs (entry) do
assert (value == true, "attrsonly failed")
end
end
+ -- checking reuse of search object.
+ local iter = assert (LD:search { base = BASE, scope = "base", })
+ assert (type(iter) == "function")
+ local dn, e1 = iter()
+ assert (type(dn) == "string")
+ assert (type(e1) == "table")
+ dn, e1 = iter()
+ assert (type(dn) == "nil")
+ assert (type(e1) == "nil")
+ dn, e1 = iter()
+ assert (type(dn) == "nil")
+ assert (type(e1) == "nil")
end