6806344
From 85891948cd7b6e9eed2c0e4b199de2a8d19a0824 Mon Sep 17 00:00:00 2001
6806344
From: Dan Callaghan <dcallagh@redhat.com>
6806344
Date: Mon, 30 Jun 2014 11:18:04 +1000
6806344
Subject: [PATCH 1/2] update test.lua for 5.2
6806344
6806344
6806344
diff --git a/lualdap/tests/test.lua b/lualdap/tests/test.lua
6806344
index 2dce95b..76c8640 100755
6806344
--- a/lualdap/tests/test.lua
6806344
+++ b/lualdap/tests/test.lua
6806344
@@ -27,7 +27,7 @@ function print_attrs (dn, attrs)
6806344
 		if tv == "string" then
6806344
 			io.write (values)
6806344
 		elseif tv == "table" then
6806344
-			local n = table.getn (values)
6806344
+			local n = #values
6806344
 			for i = 1, n-1 do
6806344
 				io.write (values[i]..",")
6806344
 			end
6806344
@@ -77,7 +77,7 @@ function test_object (obj, objmethods)
6806344
 	-- trying to set metatable.
6806344
 	assert2 (false, pcall (setmetatable, ENV, {}))
6806344
 	-- checking existence of object's methods.
6806344
-	for i = 1, table.getn (objmethods) do
6806344
+	for i = 1, #objmethods do
6806344
 		local method = obj[objmethods[i]]
6806344
 		assert2 ("function", type(method))
6806344
 		assert2 (false, pcall (method), "no 'self' parameter accepted")
6806344
@@ -128,7 +128,7 @@ end
6806344
 -- checks return value which should be a function AND also its return value.
6806344
 ---------------------------------------------------------------------
6806344
 function check_future (ret, method, ...)
6806344
-	local ok, f = pcall (method, unpack (arg))
6806344
+	local ok, f = pcall (method, ...)
6806344
 	assert (ok, f)
6806344
 	assert2 ("function", type(f))
6806344
 	assert2 (ret, f())
6806344
@@ -377,7 +377,7 @@ tests = {
6806344
 -- Main
6806344
 ---------------------------------------------------------------------
6806344
 
6806344
-if table.getn(arg) < 1 then
6806344
+if #arg < 1 then
6806344
 	print (string.format ("Usage %s host[:port] base [who [password]]", arg[0]))
6806344
 	os.exit()
6806344
 end
6806344
@@ -390,7 +390,7 @@ PASSWORD = arg[4]
6806344
 require"lualdap"
6806344
 assert (type(lualdap)=="table", "couldn't load LDAP library")
6806344
 
6806344
-for i = 1, table.getn (tests) do
6806344
+for i = 1, #tests do
6806344
 	local t = tests[i]
6806344
 	io.write (t[1].." ...")
6806344
 	t[2] ()
6806344
-- 
6806344
1.9.3
6806344