phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0
This commit is contained in:
71
local_tests/test_static_box_patterns.hako
Normal file
71
local_tests/test_static_box_patterns.hako
Normal file
@ -0,0 +1,71 @@
|
||||
// Test for proper static box usage patterns
|
||||
static box StaticBoxTest {
|
||||
init { console, test_result }
|
||||
|
||||
main() {
|
||||
me.console = new ConsoleBox()
|
||||
me.console.log("🧪 Testing proper static box patterns")
|
||||
|
||||
// ✅ Correct: Call static method directly
|
||||
local result = StaticBoxTest.test_static_method()
|
||||
me.console.log("Static method result: " + result)
|
||||
|
||||
// ✅ Correct: Access static box fields through me
|
||||
me.test_result = "Static box initialization successful"
|
||||
me.console.log("Static field access: " + me.test_result)
|
||||
|
||||
me.console.log("✅ Static box pattern tests completed")
|
||||
return "Static box usage verified"
|
||||
}
|
||||
|
||||
test_static_method() {
|
||||
return "Static method executed successfully"
|
||||
}
|
||||
}
|
||||
|
||||
// Test proxy server pattern (simplified)
|
||||
static box SimpleProxyTest {
|
||||
init { console, port, running }
|
||||
|
||||
main() {
|
||||
me.console = new ConsoleBox()
|
||||
me.console.log("🌐 Testing simplified proxy server pattern")
|
||||
|
||||
// ✅ Correct: Initialize static box fields
|
||||
me.port = 8080
|
||||
me.running = true
|
||||
|
||||
me.console.log("Proxy configured on port: " + me.port)
|
||||
me.console.log("Proxy running status: " + me.running)
|
||||
|
||||
// ✅ Correct: Call other static methods
|
||||
local startup_result = SimpleProxyTest.simulate_startup()
|
||||
me.console.log("Startup result: " + startup_result)
|
||||
|
||||
return "Proxy simulation complete"
|
||||
}
|
||||
|
||||
simulate_startup() {
|
||||
return "Proxy server simulation started successfully"
|
||||
}
|
||||
}
|
||||
|
||||
// Entry point
|
||||
static box Main {
|
||||
init { console }
|
||||
|
||||
main() {
|
||||
me.console = new ConsoleBox()
|
||||
me.console.log("🚀 Testing Static Box Patterns")
|
||||
|
||||
// Test both static box patterns
|
||||
local test1_result = StaticBoxTest.main()
|
||||
me.console.log("Test 1: " + test1_result)
|
||||
|
||||
local test2_result = SimpleProxyTest.main()
|
||||
me.console.log("Test 2: " + test2_result)
|
||||
|
||||
me.console.log("✅ All static box pattern tests passed")
|
||||
return "Static box tests complete"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user