test: integration_tests.rsを新しいNyash構文に更新
古い構文から新しい構文への更新:
- this → me に変更
- フィールド宣言を init { } 構文に変更
- init()メソッド → birth()コンストラクタに変更
結果: 16個の統合テストすべて成功
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -148,11 +148,10 @@ mod integration_tests {
|
|||||||
fn test_box_instance_creation() {
|
fn test_box_instance_creation() {
|
||||||
let code = r#"
|
let code = r#"
|
||||||
box Point {
|
box Point {
|
||||||
x
|
init { x, y }
|
||||||
y
|
|
||||||
|
|
||||||
getX() {
|
getX() {
|
||||||
return this.x
|
return me.x
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,16 +171,16 @@ mod integration_tests {
|
|||||||
value
|
value
|
||||||
|
|
||||||
setValue(v) {
|
setValue(v) {
|
||||||
this.value = v
|
me.value = v
|
||||||
}
|
}
|
||||||
|
|
||||||
getValue() {
|
getValue() {
|
||||||
return this.value
|
return me.value
|
||||||
}
|
}
|
||||||
|
|
||||||
add(amount) {
|
add(amount) {
|
||||||
this.value = this.value + amount
|
me.value = me.value + amount
|
||||||
return this.value
|
return me.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,25 +198,23 @@ mod integration_tests {
|
|||||||
fn test_method_chaining_concept() {
|
fn test_method_chaining_concept() {
|
||||||
let code = r#"
|
let code = r#"
|
||||||
box Counter {
|
box Counter {
|
||||||
count
|
init { count }
|
||||||
|
|
||||||
init() {
|
birth() {
|
||||||
this.count = 0
|
me.count = 0
|
||||||
return this
|
|
||||||
}
|
}
|
||||||
|
|
||||||
increment() {
|
increment() {
|
||||||
this.count = this.count + 1
|
me.count = me.count + 1
|
||||||
return this.count
|
return me.count
|
||||||
}
|
}
|
||||||
|
|
||||||
getCount() {
|
getCount() {
|
||||||
return this.count
|
return me.count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c = new Counter()
|
c = new Counter()
|
||||||
c.init()
|
|
||||||
c.increment()
|
c.increment()
|
||||||
c.increment()
|
c.increment()
|
||||||
c.increment()
|
c.increment()
|
||||||
@ -232,14 +229,14 @@ mod integration_tests {
|
|||||||
fn test_multiple_instances() {
|
fn test_multiple_instances() {
|
||||||
let code = r#"
|
let code = r#"
|
||||||
box Data {
|
box Data {
|
||||||
value
|
init { value }
|
||||||
|
|
||||||
setValue(v) {
|
setValue(v) {
|
||||||
this.value = v
|
me.value = v
|
||||||
}
|
}
|
||||||
|
|
||||||
getValue() {
|
getValue() {
|
||||||
return this.value
|
return me.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,27 +292,27 @@ mod integration_tests {
|
|||||||
fn test_nested_method_calls() {
|
fn test_nested_method_calls() {
|
||||||
let code = r#"
|
let code = r#"
|
||||||
box Wrapper {
|
box Wrapper {
|
||||||
inner
|
init { inner }
|
||||||
|
|
||||||
setInner(value) {
|
setInner(value) {
|
||||||
this.inner = value
|
me.inner = value
|
||||||
}
|
}
|
||||||
|
|
||||||
getInner() {
|
getInner() {
|
||||||
return this.inner
|
return me.inner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
box Container {
|
box Container {
|
||||||
wrapper
|
init { wrapper }
|
||||||
|
|
||||||
createWrapper() {
|
createWrapper() {
|
||||||
this.wrapper = new Wrapper()
|
me.wrapper = new Wrapper()
|
||||||
return this.wrapper
|
return me.wrapper
|
||||||
}
|
}
|
||||||
|
|
||||||
getWrapper() {
|
getWrapper() {
|
||||||
return this.wrapper
|
return me.wrapper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,10 +356,10 @@ mod integration_tests {
|
|||||||
// 元のdebug_this_problem.nyashと同等のテスト
|
// 元のdebug_this_problem.nyashと同等のテスト
|
||||||
let code = r#"
|
let code = r#"
|
||||||
box TestBox {
|
box TestBox {
|
||||||
value
|
init { value }
|
||||||
|
|
||||||
getValue() {
|
getValue() {
|
||||||
return this.value
|
return me.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user