Files
hakorune/tests/development/test_pack_syntax_simple.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

46 lines
1.3 KiB
Plaintext

// 📦 pack構文テスト - ビルトインBox継承専用機能確認
// ビルトインBoxを継承してpack構文をテスト
box MyMathBox from MathBox {
init { history } // 追加フィールド
pack() {
from MathBox.pack() // 親のpackを呼び出し
me.history = new ArrayBox() // 履歴追加
print("✅ MyMathBox pack完了")
}
override sin(x) {
local result = from MathBox.sin(x)
me.history.push("sin(" + x + ") = " + result)
print("📝 履歴追加: sin(" + x + ") = " + result)
return result
}
getHistory() {
return me.history
}
}
static box Main {
init { console }
main() {
me.console = new ConsoleBox()
me.console.log("🧪 pack構文テスト開始")
// packコンストラクタでインスタンス作成
local mathCalc = new MyMathBox()
me.console.log("✅ MyMathBox作成成功")
// sin計算テスト
local result = mathCalc.sin(1.5708) // π/2 ≈ 90度
me.console.log("🔢 sin(π/2) = " + result)
// 履歴確認
local history = mathCalc.getHistory()
me.console.log("📚 履歴サイズ: " + history.length())
return "pack構文テスト完了"
}
}