Skip to content

Commit

Permalink
added e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
i582 committed Jan 28, 2025
1 parent d551f36 commit eb9b5ec
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/test/e2e-emulated/contracts/mutating-methods.tact
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ struct Foo {
s: Slice;
}

struct MyStruct {
age: Int;
}

fun returnMyStruct(): MyStruct {
return MyStruct{ age: 10 };
}

extends mutates fun setAge(self: MyStruct, age: Int): Int {
let old = self.age;
self.age = age;
return old + self.age;
}

contract Tester {
s: Slice;

Expand Down Expand Up @@ -84,4 +98,8 @@ contract Tester {
x.multiplyExtends(2).multiplyExtends(3);
return x.multiplyExtends(2).multiplyExtends(3);
}
}

get fun test12(): Int {
return returnMyStruct().setAge(20);
}
}
1 change: 1 addition & 0 deletions src/test/e2e-emulated/mutating-methods.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@ describe("bugs", () => {

expect(await contract.getTest11(1n)).toBe(6n);
expect(await contract.getTest11(2n)).toBe(12n);
expect(await contract.getTest12()).toBe(30n);
});
});

0 comments on commit eb9b5ec

Please sign in to comment.