diff options
Diffstat (limited to 'tests/features')
| -rw-r--r-- | tests/features/test_match_ref.zc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/features/test_match_ref.zc b/tests/features/test_match_ref.zc new file mode 100644 index 0000000..9734ffe --- /dev/null +++ b/tests/features/test_match_ref.zc @@ -0,0 +1,17 @@ + +enum MyOption<T> { + Some(T), + None +} + +test "match_ref_int" { + var r = MyOption<int>::Some(42); + match r { + MyOption::Some(ref i) => { + // i is int* + assert(*i == 42, "int ref check failed"); + *i = 100; + }, + MyOption::None => assert(false, "fail") + } +} |
