Files
hakorune/local_tests/test_final_validation.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

51 lines
1.8 KiB
Plaintext

// Final validation test for the SocketBox state preservation fix
// This test replicates the exact scenario described in issue #74
static box Main {
init { server }
main() {
print("=== Issue #74 Validation Test ===")
print("Testing SocketBox state preservation across field accesses")
print("")
// Create SocketBox and store in field
me.server = new SocketBox()
print("Step 1: Initial state")
print("me.server.isServer(): " + me.server.isServer()) // Should be false
print("")
print("Step 2: Calling bind() to set server state")
me.server.bind("127.0.0.1", 8080) // This should set is_server=true
print("bind() completed")
print("")
print("Step 3: Checking state after bind()")
print("me.server.isServer(): " + me.server.isServer()) // Should be true if fix works!
print("")
// Additional tests: multiple accesses should all return same state
print("Step 4: Multiple field access test")
local server1
server1 = me.server
print("server1.isServer(): " + server1.isServer()) // Should be true
local server2
server2 = me.server
print("server2.isServer(): " + server2.isServer()) // Should be true
print("")
print("=== Test Summary ===")
if (me.server.isServer()) {
print("✅ SUCCESS: SocketBox state preserved across field accesses!")
print(" The 'Everything is Box' design now correctly shares state")
print(" for stateful boxes like SocketBox, P2PBox, etc.")
} else {
print("❌ FAILURE: SocketBox state was not preserved")
print(" The fix did not work as expected")
}
return me.server.isServer()
}
}