36 lines
1.1 KiB
Plaintext
36 lines
1.1 KiB
Plaintext
|
|
// Test null literal support
|
||
|
|
static box NullLiteralTest {
|
||
|
|
init { console }
|
||
|
|
|
||
|
|
main() {
|
||
|
|
me.console = new ConsoleBox()
|
||
|
|
me.console.log("🧪 Testing null literal support")
|
||
|
|
|
||
|
|
// Test 1: Basic null assignment
|
||
|
|
local null_value = null
|
||
|
|
me.console.log("Null value: " + null_value)
|
||
|
|
|
||
|
|
// Test 2: Null comparison
|
||
|
|
if null_value == null {
|
||
|
|
me.console.log("✅ Null comparison works")
|
||
|
|
} else {
|
||
|
|
me.console.log("❌ Null comparison failed")
|
||
|
|
}
|
||
|
|
|
||
|
|
// Test 3: Null vs non-null
|
||
|
|
local non_null = "not null"
|
||
|
|
if non_null != null {
|
||
|
|
me.console.log("✅ Non-null comparison works")
|
||
|
|
} else {
|
||
|
|
me.console.log("❌ Non-null comparison failed")
|
||
|
|
}
|
||
|
|
|
||
|
|
// Test 4: Null in conditions
|
||
|
|
if null_value == null {
|
||
|
|
me.console.log("✅ Null condition evaluation works")
|
||
|
|
}
|
||
|
|
|
||
|
|
me.console.log("✅ Null literal tests completed")
|
||
|
|
return "Null literal support verified"
|
||
|
|
}
|
||
|
|
}
|