mirror of
https://github.com/gnu4cn/rust-lang-zh_CN.git
synced 2025-01-13 13:50:37 +08:00
36 lines
648 B
Rust
36 lines
648 B
Rust
use super::*;
|
|
|
|
#[test]
|
|
fn filter_by_size() {
|
|
let shoes = vec! [
|
|
Shoe {
|
|
size: 10,
|
|
style: String::from("sneaker"),
|
|
},
|
|
Shoe {
|
|
size: 13,
|
|
style: String::from("sandal"),
|
|
},
|
|
Shoe {
|
|
size: 10,
|
|
style: String::from("boot"),
|
|
},
|
|
];
|
|
|
|
let in_my_size = shoes_in_size(shoes, 10);
|
|
|
|
assert_eq! (
|
|
in_my_size,
|
|
vec! [
|
|
Shoe {
|
|
size: 10,
|
|
style: String::from("sneaker"),
|
|
},
|
|
Shoe {
|
|
size: 10,
|
|
style: String::from("boot"),
|
|
},
|
|
]
|
|
);
|
|
}
|