Incorporate a stray test
This commit is contained in:
parent
3d0e93309d
commit
b326e71b79
3 changed files with 12 additions and 19 deletions
|
@ -1,19 +0,0 @@
|
|||
// 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]);
|
||||
}
|
|
@ -24,6 +24,7 @@
|
|||
#![feature(try_reserve)]
|
||||
#![feature(unboxed_closures)]
|
||||
#![feature(exact_chunks)]
|
||||
#![feature(repeat_generic_slice)]
|
||||
|
||||
extern crate alloc_system;
|
||||
extern crate core;
|
||||
|
|
|
@ -1529,3 +1529,14 @@ fn panic_safe() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn repeat_generic_slice() {
|
||||
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]
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue