Null my old friend
This commit is contained in:
@@ -54,6 +54,11 @@ func testExpectedObject(t *testing.T, expected interface{}, actual object.Object
|
||||
if err != nil {
|
||||
t.Errorf("testBooleanObject failed: %s", err)
|
||||
}
|
||||
|
||||
case *object.Null:
|
||||
if actual != Null {
|
||||
t.Errorf("object is not Null: %T (%+v)", actual, actual)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +143,7 @@ func TestBooleanExpressions(t *testing.T) {
|
||||
{"!!true", true},
|
||||
{"!!false", false},
|
||||
{"!!5", true},
|
||||
{"!(if (false) { 5; })", true},
|
||||
}
|
||||
|
||||
runVmTests(t, tests)
|
||||
@@ -152,6 +158,9 @@ func TestConditionals(t *testing.T) {
|
||||
{"if (1 < 2) { 10 }", 10},
|
||||
{"if (1 < 2) { 10 } else { 20 }", 10},
|
||||
{"if (1 > 2) { 10 } else { 20 }", 20},
|
||||
{"if (1 > 2) { 10 }", Null},
|
||||
{"if (false) { 10 }", Null},
|
||||
{"if ((if (false) { 10 })) { 10 } else { 20 }", 20},
|
||||
}
|
||||
|
||||
runVmTests(t, tests)
|
||||
|
||||
Reference in New Issue
Block a user