diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/alt-pattern-drop.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/test/run-pass/alt-pattern-drop.rs b/src/test/run-pass/alt-pattern-drop.rs index 4adf2f3a..68e4f13e 100644 --- a/src/test/run-pass/alt-pattern-drop.rs +++ b/src/test/run-pass/alt-pattern-drop.rs @@ -5,15 +5,21 @@ import std._str; type t = tag(make_t(str), clam()); -fn main() { - let str s = "hi"; // ref up +fn foo(str s) { let t x = make_t(s); // ref up alt (x) { - case (make_t(y)) { log y; } // ref up and ref down + case (make_t(y)) { log y; } // ref up then down case (_) { log "?"; fail; } } log _str.refcount(s); - check (_str.refcount(s) == 2u); + check (_str.refcount(s) == 3u); +} + +fn main() { + let str s = "hi"; // ref up + foo(s); // ref up then down + log _str.refcount(s); + check (_str.refcount(s) == 1u); } |