71 lines
2.1 KiB
Plaintext
71 lines
2.1 KiB
Plaintext
// 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"
|
|
}
|
|
} |