Files
hakorune/local_tests/test_static_box_patterns.nyash
Moe Charm ef7a0de3b0 feat: Prepare for code modularization and cleanup
- Archive old documentation and test files to `docs/archive/` and `local_tests/`.
- Remove various temporary and old files from the project root.
- Add `nekocode-rust` analysis tool and its output files (`nekocode/`, `.nekocode_sessions/`, `analysis.json`).
- Minor updates to `apps/chip8_nyash/chip8_emulator.nyash` and `local_tests` files.

This commit cleans up the repository and sets the stage for further code modularization efforts, particularly in the `src/interpreter` and `src/parser` modules, based on recent analysis.
2025-08-16 01:30:39 +09:00

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"
}
}