From b106fe19b55e9fe3348b3a5c9992c21dac27b02c Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Tue, 20 Jan 2026 12:51:23 +0000 Subject: Working a bit on the LSP + fixed some bugs --- tests/features/test_match_ref.zc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tests') diff --git a/tests/features/test_match_ref.zc b/tests/features/test_match_ref.zc index 9734ffe..4e04b89 100644 --- a/tests/features/test_match_ref.zc +++ b/tests/features/test_match_ref.zc @@ -15,3 +15,28 @@ test "match_ref_int" { MyOption::None => assert(false, "fail") } } +// Mover struct to test move semantics vs ref +struct Mover { + val: int; +} + +test "match_ref_mover" { + var m = Mover { val: 100 }; + // MyOption instantiation + var opt = MyOption::Some(m); + + match opt { + MyOption::Some(ref x) => { + // x should be Mover* + assert(x.val == 100, "Mover ref access failed"); + x.val = 200; + }, + MyOption::None => assert(false, "Should be Some") + } + + // Check if modification persisted + match opt { + MyOption::Some(v) => assert(v.val == 200, "Mutation via ref failed"), + MyOption::None => {} + } +} -- cgit v1.2.3