monotone-commits-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-commits-diffs] net.venge.monotone.lua-5.2: d87f33bf21cbe464b78


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone.lua-5.2: d87f33bf21cbe464b78fa22f2ae839e4e1dabb2b
Date: Wed, 25 Apr 2012 16:25:46 +0200 (CEST)

revision:            d87f33bf21cbe464b78fa22f2ae839e4e1dabb2b
date:                2012-04-25T13:43:57
author:              Richard Levitte <address@hidden>
branch:              net.venge.monotone.lua-5.2
changelog:
* test/src/testlib.lua (samelines, greplines, tail, run_tests):
  table.getn is deprecated in Lua 5.2 and could already be replaced with
  the length operator (#) in Lua 5.1.

manifest:
format_version "1"

new_manifest [ffeffc79337243d2988de8cef73e3b0c6e21974b]

old_revision [708a84ff566d014308bcb8f62db3d79a58f09d17]

patch "test/src/testlib.lua"
 from [87a3065f8f8c4712a31f4f8cfe0edc9ff9b8be3d]
   to [445ed7ee75dfde94af676e7644e29e874aff58d7]
============================================================
--- test/src/testlib.lua	87a3065f8f8c4712a31f4f8cfe0edc9ff9b8be3d
+++ test/src/testlib.lua	445ed7ee75dfde94af676e7644e29e874aff58d7
@@ -489,12 +489,11 @@ function samelines(f, t)
 function samelines(f, t)
   local fl = {}
   for l in io.lines(f) do table.insert(fl, l) end
-  if not (table.getn(fl) == table.getn(t)) then
-    L(locheader(), string.format("file has %s lines; table has %s\n",
-                                 table.getn(fl), table.getn(t)))
+  if not (#fl == #t) then
+    L(locheader(), string.format("file has %s lines; table has %s\n", #fl, #t))
     return false
   end
-  for i=1,table.getn(t) do
+  for i=1,#t do
     if fl[i] ~= t[i] then
       if fl[i] then
         L(locheader(), string.format("file[%d] = '%s'; table[%d] = '%s'\n",
@@ -512,12 +511,11 @@ function greplines(f, t)
 function greplines(f, t)
   local fl = {}
   for l in io.lines(f) do table.insert(fl, l) end
-  if not (table.getn(fl) == table.getn(t)) then
-    L(locheader(), string.format("file has %s lines; table has %s\n",
-                                 table.getn(fl), table.getn(t)))
+  if not (#fl == #t) then
+    L(locheader(), string.format("file has %s lines; table has %s\n", #fl, #t))
     return false
   end
-  for i=1,table.getn(t) do
+  for i=1,#t do
     if not regex.search(t[i], fl[i]) then
       L(locheader(), string.format("file[i] = '%s'; table[i] = '%s'\n",
                                    fl[i], t[i]))
@@ -587,7 +585,7 @@ function tail(...)
     local mylines = {}
     for l in io.lines(file) do
       table.insert(mylines, l)
-      if table.getn(mylines) > num then
+      if #mylines > num then
         table.remove(mylines, 1)
       end
     end
@@ -942,8 +940,8 @@ function run_tests(debugging, list_only,
     if _1 then
       l = l + 0
       r = r + 0
-      if l < 1 then l = table.getn(tests) + l + 1 end
-      if r < 1 then r = table.getn(tests) + r + 1 end
+      if l < 1 then l = #tests + l + 1 end
+      if r < 1 then r = #tests + r + 1 end
       if l > r then l,r = r,l end
       for j = l,r do
         torun[j] = tests[j]
@@ -951,7 +949,7 @@ function run_tests(debugging, list_only,
       run_all = false
     elseif string.find(a, "^-?%d+$") then
       r = a + 0
-      if r < 1 then r = table.getn(tests) + r + 1 end
+      if r < 1 then r = #tests + r + 1 end
       torun[r] = tests[r]
       run_all = false
     else

reply via email to

[Prev in Thread] Current Thread [Next in Thread]