diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/use.toc | 36 | ||||
-rw-r--r-- | tests/use_expected | 4 |
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/use.toc b/tests/use.toc index 98e9221..ec062c2 100644 --- a/tests/use.toc +++ b/tests/use.toc @@ -9,11 +9,41 @@ Point ::= struct { a ::= 3; } +Point3D ::= struct { + use point: Point; + z: int; + +} + +Point4D ::= struct { + use p3: Point3D; + w: int; +} + +Foo ::= struct { + f: f32; +} + +Bar ::= struct { + use foo: Foo; + use p4: Point4D; +} + + + make_point ::= fn (x_: int, y_: int) use p: Point { x = x_+a; y = y_+a; } +make_bar ::= fn (x_ := 0, y_ := 0, z_ := 0, w_ := 0, f_ := 0.0) use b: Bar { + x = x_; + y = y_; + z = z_; + b.p4.w = w_; + b.f = f_; +} + main ::= fn() { use io; @@ -42,4 +72,10 @@ main ::= fn() { puts(""); } dels(ps); + b := make_bar(5, 8, 13, 12); + puti(b.x); + puti(b.y); + puti(b.z); + puti(b.w); + } diff --git a/tests/use_expected b/tests/use_expected index d47a933..0470d66 100644 --- a/tests/use_expected +++ b/tests/use_expected @@ -4,3 +4,7 @@ 8 12 9 14 10 16 +5 +8 +13 +12 |