45 lines
762 B
Plaintext
45 lines
762 B
Plaintext
|
|
// 最小限のBoxテスト
|
||
|
|
|
||
|
|
print("=== Minimal Box Test ===")
|
||
|
|
|
||
|
|
// Step 1: フィールドなしBox
|
||
|
|
box EmptyBox {
|
||
|
|
init { }
|
||
|
|
|
||
|
|
hello() {
|
||
|
|
print("Hello from EmptyBox")
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
print("Creating EmptyBox...")
|
||
|
|
local e
|
||
|
|
e = new EmptyBox()
|
||
|
|
print("Calling hello...")
|
||
|
|
e.hello()
|
||
|
|
print("EmptyBox test done")
|
||
|
|
|
||
|
|
// Step 2: フィールドありBox
|
||
|
|
box BoxWithField {
|
||
|
|
init { value }
|
||
|
|
|
||
|
|
setValue(v) {
|
||
|
|
me.value = v
|
||
|
|
print("Value set to: " + v)
|
||
|
|
}
|
||
|
|
|
||
|
|
getValue() {
|
||
|
|
return me.value
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
print("\nCreating BoxWithField...")
|
||
|
|
local b
|
||
|
|
b = new BoxWithField()
|
||
|
|
print("Setting value...")
|
||
|
|
b.setValue("test")
|
||
|
|
print("Getting value...")
|
||
|
|
local result
|
||
|
|
result = b.getValue()
|
||
|
|
print("Result: " + result)
|
||
|
|
|
||
|
|
print("\nAll tests completed!")
|