Fix a bug in how comparison instructions are handled: the 'a' intruction field
was ignored. Includes new test case.
This commit is contained in:
@@ -223,7 +223,7 @@ public class CallFrame {
|
||||
rkb = GETARG_RKB(i);
|
||||
rkc = GETARG_RKC(i);
|
||||
boolean test = rkc.luaBinCmpUnknown(o, rkb);
|
||||
if (test)
|
||||
if (test == (a == 0))
|
||||
pc++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,10 @@ public class LuaJTest extends TestCase {
|
||||
runTest( "test7" );
|
||||
}
|
||||
|
||||
public void testCompare() throws IOException, InterruptedException {
|
||||
runTest( "compare" );
|
||||
}
|
||||
|
||||
public void testUpvalues() throws IOException, InterruptedException {
|
||||
runTest( "upvalues" );
|
||||
}
|
||||
|
||||
12
src/test/res/compare.lua
Normal file
12
src/test/res/compare.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
if 2 < 5 then
|
||||
print("OK!")
|
||||
else
|
||||
print("Something is not right")
|
||||
end
|
||||
|
||||
print(2 < 5)
|
||||
print(2 <= 5)
|
||||
print(2 == 5)
|
||||
print(2 ~= 5)
|
||||
print(2 > 5)
|
||||
print(2 >= 5)
|
||||
BIN
src/test/res/compare.luac
Normal file
BIN
src/test/res/compare.luac
Normal file
Binary file not shown.
Reference in New Issue
Block a user