Fix ModuloBox E0046 error and add null literal support

Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-08-15 07:29:52 +00:00
parent 426571db5e
commit aae81ec4d5
9 changed files with 205 additions and 1 deletions

View File

@ -0,0 +1,43 @@
// Test for ArrayBox.length() functionality
static box ArrayLengthTest {
init { console }
main() {
me.console = new ConsoleBox()
me.console.log("🧪 Testing ArrayBox.length() functionality")
// Test 1: Empty array
local empty_array = new ArrayBox()
local empty_length = empty_array.length()
me.console.log("Empty array length: " + empty_length) // Expected: 0
// Test 2: Array with elements
local test_array = new ArrayBox()
test_array.push("first")
test_array.push("second")
test_array.push("third")
local length_after_push = test_array.length()
me.console.log("Array length after 3 pushes: " + length_after_push) // Expected: 3
// Test 3: Array after pop
local popped = test_array.pop()
me.console.log("Popped element: " + popped)
local length_after_pop = test_array.length()
me.console.log("Array length after pop: " + length_after_pop) // Expected: 2
// Test 4: Verify elements are still accessible
local first_element = test_array.get(0)
local second_element = test_array.get(1)
me.console.log("Element at index 0: " + first_element)
me.console.log("Element at index 1: " + second_element)
// Test 5: Edge case - accessing beyond length
local beyond_length = test_array.get(5)
me.console.log("Element beyond length: " + beyond_length) // Expected: null
me.console.log("✅ ArrayBox.length() tests completed")
return "ArrayBox functionality verified"
}
}