Files
hakorune/local_tests/test_birth_simple.nyash

31 lines
819 B
Plaintext
Raw Normal View History

// 🌟 birth()統一システムテスト
// birth()のみが使用可能で、Box名コンストラクタは禁止されていることを確認
box LifeBox {
init { name, energy }
birth(lifeName) {
me.name = lifeName
me.energy = 100
print("🌟 " + lifeName + " が誕生しました!")
}
getInfo() {
return me.name + " (energy: " + me.energy + ")"
}
}
static box Main {
init { console }
main() {
me.console = new ConsoleBox()
me.console.log("🚀 birth()統一システムテスト開始")
// ✅ birth()を使った正しい生成
local alice = new LifeBox("Alice")
me.console.log("結果: " + alice.getInfo())
return "birth()統一システム テスト完了"
}
}