aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-24 15:04:57 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-24 15:04:57 +0200
commited84714a5dc721beecae3996ebe81678d6680bf2 (patch)
treea18901fb690a30ca6695a51576498e819b98d3bd
parent4cdbde1b03edf85c47e4497e496c668c733b6639 (diff)
downloadfengari-ed84714a5dc721beecae3996ebe81678d6680bf2.tar.gz
fengari-ed84714a5dc721beecae3996ebe81678d6680bf2.tar.bz2
fengari-ed84714a5dc721beecae3996ebe81678d6680bf2.zip
[test-suite] sort.js passes
-rw-r--r--README.md4
-rw-r--r--tests/ldblib.js2
-rw-r--r--tests/test-suite/sort.js (renamed from tests/test-suite/inprogress/sort.js)22
3 files changed, 14 insertions, 14 deletions
diff --git a/README.md b/README.md
index ed7a5f5..b4c281a 100644
--- a/README.md
+++ b/README.md
@@ -64,14 +64,14 @@
- [x] `locals.lua` (10/10)
- [x] `math.lua` (68/68)
- [x] `nextvar.lua` (44/44)
+ - [x] `sort.lua` (24/24)
- [x] `strings.lua` (34/34)
- [x] `vararg.lua` (8/8)
- - [ ] `attrib.lua`
- [ ] `coroutine.lua` (32/40)
- [ ] `pm.lua` (27/38)
- - [ ] `sort.lua` (21/24)
- [ ] `tpack.lua` (20/32)
- [ ] `utf8.lua` (14/20)
+ - [ ] `attrib.lua`
- [ ] `api.lua`
- [ ] `big.lua`
- [ ] `code.lua`
diff --git a/tests/ldblib.js b/tests/ldblib.js
index f381d8e..82d40c2 100644
--- a/tests/ldblib.js
+++ b/tests/ldblib.js
@@ -44,7 +44,7 @@ test('debug.sethook', function (t) {
t.strictEqual(
lua.lua_tojsstring(L, -1),
- "return count line count line count line count return count line count line count return count line count line count return count line ",
+ "return count line count line count line count line return count line count line count line return count line count line count line return count line ",
"Correct element(s) on the stack"
);
diff --git a/tests/test-suite/inprogress/sort.js b/tests/test-suite/sort.js
index fc0762f..0b13861 100644
--- a/tests/test-suite/inprogress/sort.js
+++ b/tests/test-suite/sort.js
@@ -4,9 +4,9 @@ const test = require('tape');
global.WEB = false;
-const lua = require('../../../src/lua.js');
-const lauxlib = require('../../../src/lauxlib.js');
-const lualib = require('../../../src/lualib.js');
+const lua = require('../../src/lua.js');
+const lauxlib = require('../../src/lauxlib.js');
+const lualib = require('../../src/lualib.js');
const prefix = `
@@ -521,6 +521,13 @@ test("[test-suite] sort: Invert-sorting", function (t) {
print(string.format("Invert-sorting other %d elements in %.2f msec., with %i comparisons",
limit, x, i))
check(a, function(x,y) return y<x end)
+
+ table.sort{} -- empty array
+
+ for i=1,limit do a[i] = false end
+ timesort(a, limit, function(x,y) return nil end, "equal")
+
+ for i,v in pairs(a) do assert(v == false) end
`, L;
t.plan(2);
@@ -553,20 +560,13 @@ test("[test-suite] sort: sorting", function (t) {
end
end
- table.sort{} -- empty array
-
- for i=1,limit do a[i] = false end
- timesort(a, limit, function(x,y) return nil end, "equal")
-
- for i,v in pairs(a) do assert(v == false) end
-
A = {"álo", "\\0first :-)", "alo", "then this one", "45", "and a new"}
table.sort(A)
check(A)
table.sort(A, function (x, y)
load(string.format("A[%q] = ''", x), "")()
- collectgarbage()
+ -- collectgarbage()
return x<y
end)