about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2018-03-27 16:52:55 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2018-03-28 09:02:27 +0200
commit3c1fea9c0de008d105e8e043b53c4aba57d0df65 (patch)
tree9512a6c915560b457215c4aeddd68f6c9c883d45 /src/liballoc
parent1ef70a00ab2727360e36ec07bccc2838caa1db64 (diff)
downloadrust-3c1fea9c0de008d105e8e043b53c4aba57d0df65.tar.gz
rust-3c1fea9c0de008d105e8e043b53c4aba57d0df65.zip
Add run-pass test for repeat-generic-slice feature
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/repeat-generic-slice.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/liballoc/repeat-generic-slice.rs b/src/liballoc/repeat-generic-slice.rs
new file mode 100644
index 00000000000..5c14ee4fd83
--- /dev/null
+++ b/src/liballoc/repeat-generic-slice.rs
@@ -0,0 +1,19 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(repeat_generic_slice)]
+
+fn main() {
+    assert_eq!([1, 2].repeat(2), vec![1, 2, 1, 2]);
+    assert_eq!([1, 2, 3, 4].repeat(0), vec![]);
+    assert_eq!([1, 2, 3, 4].repeat(1), vec![1, 2, 3, 4]);
+    assert_eq!([1, 2, 3, 4].repeat(3),
+               vec![1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]);
+}