summaryrefslogtreecommitdiff
path: root/tests/features/test_alias.zc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/features/test_alias.zc')
-rw-r--r--tests/features/test_alias.zc24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/features/test_alias.zc b/tests/features/test_alias.zc
index 5ec14f1..e3f71b3 100644
--- a/tests/features/test_alias.zc
+++ b/tests/features/test_alias.zc
@@ -39,18 +39,18 @@ alias Vec2f = Vec2<f32>;
alias Vec2i = Vec2<int>;
test "alias basic" {
- var x: MyInt = 10;
- var ptr: MyIntPtr = &x;
+ let x: MyInt = 10;
+ let ptr: MyIntPtr = &x;
assert(x == 10, "Basic alias failed");
assert(*ptr == 10, "Pointer alias failed");
- var res = process(x);
+ let res = process(x);
assert(res == 11, "Function with alias arg failed");
}
test "alias struct" {
- var p: Point = Point{x: 0, y: 0};
+ let p: Point = Point{x: 0, y: 0};
p.x = 100;
p.y = 200;
@@ -58,30 +58,30 @@ test "alias struct" {
}
test "alias generic struct" {
- var v = Vec2f{x: 1.5, y: 2.5};
+ let v = Vec2f{x: 1.5, y: 2.5};
assert(v.x > 1.0, "Generic alias field access failed");
assert(v.y > 2.0, "Generic alias field access failed");
- var vi = Vec2i{x: 10, y: 20};
+ let vi = Vec2i{x: 10, y: 20};
assert(vi.x == 10, "Generic int alias failed");
assert(vi.y == 20, "Generic int alias failed");
}
test "alias fstring" {
- var v = Vec2f{x: 3.14, y: 6.28};
+ let v = Vec2f{x: 3.14, y: 6.28};
// This tests that f-string interpolation correctly resolves the alias
println "v.x = {v.x}, v.y = {v.y}";
}
test "alias function pointer" {
- // var op: BinOp;
+ // let op: BinOp;
// Assignment currently not supported for function types without casting
// op = add;
// assert(op(1, 2) == 3, "Function alias");
}
test "alias operator overloading" {
- var v = Vec2f{x: 1.0, y: 1.0};
+ let v = Vec2f{x: 1.0, y: 1.0};
v = -v; // Should call __neg
assert(v.x == -1.0, "Unary operator generic alias failed");
@@ -89,7 +89,7 @@ test "alias operator overloading" {
assert(v.x == -2.0, "Compound assignment generic alias failed");
// Control
- var v2 = Vec2<f32>{x: 1.0, y: 1.0};
+ let v2 = Vec2<f32>{x: 1.0, y: 1.0};
v2 = -v2;
v2 += v2;
assert(v2.x == -2.0, "Control generic operator overloading failed");
@@ -97,11 +97,11 @@ test "alias operator overloading" {
test "alias static methods" {
- var v1 = Vec2f::zero();
+ let v1 = Vec2f::zero();
assert(v1.x == 0.0, "Direct static call on alias failed");
println "Static call in f-string: {Vec2f::zero().x}";
- var v2 = Vec2<f32>::zero();
+ let v2 = Vec2<f32>::zero();
assert(v2.x == 0.0, "Direct static call on generic failed");
}