summaryrefslogtreecommitdiff
path: root/tests/features/test_move_semantics.zc
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-25 11:53:53 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-25 11:53:53 +0000
commit2dc5214fd8bb6a1168e2f2b643a36043c36c908a (patch)
tree55780a330598d3606205b662584a839ea60d0315 /tests/features/test_move_semantics.zc
parent6a45f6a640dc8f7b5f9819d22d68cd79fbe3c260 (diff)
Fix for #121
Diffstat (limited to 'tests/features/test_move_semantics.zc')
-rw-r--r--tests/features/test_move_semantics.zc55
1 files changed, 0 insertions, 55 deletions
diff --git a/tests/features/test_move_semantics.zc b/tests/features/test_move_semantics.zc
deleted file mode 100644
index bf0d717..0000000
--- a/tests/features/test_move_semantics.zc
+++ /dev/null
@@ -1,55 +0,0 @@
-
-struct Point {
- x: int;
-}
-
-struct Mover {
- val: int;
-}
-
-test "basic_move" {
- var p1 = Mover { val: 10 };
- var p2 = p1; // p1 moved to p2
-
- // Valid usage of p2
- assert(p2.val == 10, "p2 should be valid");
-
- // Invalid usage of p1 (Uncomment to test compiler error)
- // var p3 = p1;
-}
-
-test "primitive_copy" {
- var i = 10;
- var j = i; // Copy
- var k = i; // Copy again - should be valid
- assert(k == 10, "Primitive copy failed");
-}
-
-test "reassignment" {
- var m1 = Mover { val: 1 };
- var m2 = m1; // m1 moved
-
- m1 = Mover { val: 2 }; // Resurrect m1
- var m3 = m1; // Valid now
- assert(m3.val == 2, "Resurrection failed");
-}
-
-fn consume(m: Mover) {
- assert(m.val == 10, "Func arg failed");
-}
-
-test "func_arg" {
- var m = Mover { val: 10 };
- consume(m); // m moved
-
- // 2. Use after move (Call - Negative Test)
- // consume(m); // Should fail: Use of moved value 'm'
-}
-
-/*
-// 3. Use after return (Negative Test)
-fn fail_return(m: Mover) -> Mover {
- var m2 = m;
- return m; // Should fail: Use of moved value 'm'
-}
-*/