aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-17 10:05:56 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-17 10:05:56 +0100
commit4a03542f6ebc8c6d4ed624bc0d30f5a7148a279b (patch)
treea0801a297523d5bf6ece69a2992a7b3dbf23edf6 /tests
parent50aa5b5029165be03d0cfb34e7d664795dd80898 (diff)
downloadfengari-4a03542f6ebc8c6d4ed624bc0d30f5a7148a279b.tar.gz
fengari-4a03542f6ebc8c6d4ed624bc0d30f5a7148a279b.tar.bz2
fengari-4a03542f6ebc8c6d4ed624bc0d30f5a7148a279b.zip
Fixed UpVal.setval so that it update v index and v value on the stack
Diffstat (limited to 'tests')
-rw-r--r--tests/ltm.js25
1 files changed, 6 insertions, 19 deletions
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 () {
@@ -514,24 +511,14 @@ test('__index table with own metatable', function (t) {
}, "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"
);