From 4a03542f6ebc8c6d4ed624bc0d30f5a7148a279b Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Fri, 17 Feb 2017 10:05:56 +0100 Subject: Fixed UpVal.setval so that it update v index and v value on the stack --- tests/ltm.js | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) (limited to 'tests/ltm.js') diff --git a/tests/ltm.js b/tests/ltm.js index 9a3dee5..6f9fb8d 100644 --- a/tests/ltm.js +++ b/tests/ltm.js @@ -457,8 +457,6 @@ test('__index table with own metatable', function (t) { __index = mmt } - -- setmetatable(mt, mmt) - local t = {} -- setmetatable(t, mt) @@ -466,7 +464,7 @@ test('__index table with own metatable', function (t) { return t.yo `, L; - t.plan(6); + t.plan(5); t.comment("Running following code: \n" + luaCode); @@ -484,7 +482,7 @@ test('__index table with own metatable', function (t) { // 5 [8] SETTABLE 1 -2 -3 ; "yo" "bye" // 6 [13] NEWTABLE 2 0 1 <=== We stop here // 7 [14] SETTABLE 2 -1 1 ; "__index" - - // 8 [17] NEWTABLE 3 0 0 <=== We stop here + // 8 [17] NEWTABLE 3 0 0 // 9 [21] GETTABLE 4 3 -2 ; "yo" <=== We stop here // 10 [21] RETURN 4 2 // 11 [21] RETURN 0 1 @@ -496,7 +494,6 @@ test('__index table with own metatable', function (t) { // 3 [4] RETURN 0 1 L.stack[1].p.code[5].breakpoint = true; - L.stack[1].p.code[7].breakpoint = true; L.stack[1].p.code[8].breakpoint = true; t.doesNotThrow(function () { @@ -513,25 +510,15 @@ test('__index table with own metatable', function (t) { VM.luaV_execute(L); }, "Second part of the program executed without errors"); - L.ci.pcOff--; - L.stack[1].p.code[7].breakpoint = false; - - t.comment("We manually set mt's metatable to mmt"); - L.stack[4].metatable = L.stack[3]; - - t.doesNotThrow(function () { - VM.luaV_execute(L); - }, "Third part of the program executed without errors"); - L.ci.pcOff--; L.stack[1].p.code[8].breakpoint = false; t.comment("We manually set t's metatable to mt"); - L.stack[4].metatable = L.stack[4]; + L.stack[5].metatable = L.stack[4]; t.doesNotThrow(function () { VM.luaV_execute(L); - }, "Fourth part of the program executed without errors"); + }, "Third part of the program executed without errors"); t.strictEqual( L.stack[L.top - 1].value, @@ -639,13 +626,13 @@ test('__newindex table with own metatable', function (t) { }, "Fourth part of the program executed without errors"); t.strictEqual( - L.stack[L.top - 2].value, + L.stack[L.top - 1].value, "hello", "Program output is correct" ); t.strictEqual( - L.stack[L.top - 1].value, + L.stack[L.top - 2].value, null, "Program output is correct" ); -- cgit v1.2.3-54-g00ecf