about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/vec-slice-drop.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/run-pass/vec-slice-drop.rs b/src/test/run-pass/vec-slice-drop.rs
new file mode 100644
index 00000000000..e8709d8f108
--- /dev/null
+++ b/src/test/run-pass/vec-slice-drop.rs
@@ -0,0 +1,15 @@
+// Make sure that destructors get run on slice literals
+class foo {
+    let x: @mut int;
+    new(x: @mut int) { self.x = x; }
+    drop { *self.x += 1; }
+}
+
+fn main() {
+    let x = @mut 0;
+    {
+        let l = [foo(x)]/&;
+        assert *l[0].x == 0;
+    }
+    assert *x == 1;
+}