Files
hakorune/tests/development/test_override_validation.hako

48 lines
1022 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 🔍 override検証テスト - デリゲーションメソッドチェック機能
// 1. ✅ 正常なoverride基本テスト
box Animal {
init { name }
pack(animalName) {
me.name = animalName
}
speak() {
return me.name + " makes a sound"
}
move() {
return me.name + " moves"
}
}
box Dog from Animal {
init { breed }
pack(dogName, dogBreed) {
from Animal.pack(dogName)
me.breed = dogBreed
}
// ✅ 正常なoverride - speakメソッドは親に存在
override speak() {
return me.name + " (dog) barks: Woof!"
}
// ✅ 正常なoverride - moveメソッドも親に存在
override move() {
return me.name + " runs fast"
}
}
// テスト実行
print("=== 🔍 Override検証テスト ===")
local dog
dog = new Dog("Buddy", "Labrador")
print("Dog speak: " + dog.speak())
print("Dog move: " + dog.move())
print("")
print("✅ 正常なoverrideテスト完了")