From 2d5e085eb9fb22f8aa22bb7a19313e97be87a286 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 26 Sep 2011 17:16:34 -0700 Subject: [PATCH] Add a test that unique boxes in vectors are copied when the vector is Issue #409 --- src/test/run-pass/unique-in-vec-copy.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/test/run-pass/unique-in-vec-copy.rs diff --git a/src/test/run-pass/unique-in-vec-copy.rs b/src/test/run-pass/unique-in-vec-copy.rs new file mode 100644 index 000000000000..bad975edb565 --- /dev/null +++ b/src/test/run-pass/unique-in-vec-copy.rs @@ -0,0 +1,13 @@ +fn main() { + let a = [~mutable 10]; + let b = a; + + assert *a[0] == 10; + assert *b[0] == 10; + + // This should only modify the value in a, not b + *a[0] = 20; + + assert *a[0] == 20; + assert *b[0] == 10; +} \ No newline at end of file