diff options
| author | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-21 17:49:25 +0000 |
|---|---|---|
| committer | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-21 17:49:25 +0000 |
| commit | 83cf9acfa64b9303064db569c662df5806b464aa (patch) | |
| tree | 53f7dc9b823bae10e5691bab3c29f2e2019bce01 /tests/features | |
| parent | 5923e5f9560f3b60349965393cf81ba56c1c65ec (diff) | |
Test related to #83
Diffstat (limited to 'tests/features')
| -rw-r--r-- | tests/features/test_match_ref.zc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/features/test_match_ref.zc b/tests/features/test_match_ref.zc index 4e04b89..cdd0835 100644 --- a/tests/features/test_match_ref.zc +++ b/tests/features/test_match_ref.zc @@ -40,3 +40,25 @@ test "match_ref_mover" { MyOption::None => {} } } + +struct Hello { + world: int; +} + +enum Test { + ONE(Hello) +} + +test "match ref binding concrete" { + const t = Test::ONE(Hello{ world: 123 }); + + var val = 0; + match t { + Test::ONE(ref o) => { + // o should be Hello* + val = o.world; + } + } + + assert(val == 123, "Ref binding validation failed"); +} |
