Skip to content

Commit ab2a643

Browse files
author
Lenny222
committed
add test for list:is_empty()
1 parent d07c6e8 commit ab2a643

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/test/stdtest/list.rs

+16-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,24 @@ import core::*;
22

33
use std;
44
import std::list;
5-
import std::list::{from_vec, head, is_not_empty, tail};
5+
import std::list::{from_vec, head, is_empty, is_not_empty, tail};
66
import option;
77

8+
#[test]
9+
fn test_is_empty() {
10+
let empty : list::list<int> = from_vec([]);
11+
let full1 = from_vec([1]);
12+
let full2 = from_vec(['r', 'u']);
13+
14+
assert is_empty(empty);
15+
assert !is_empty(full1);
16+
assert !is_empty(full2);
17+
18+
assert !is_not_empty(empty);
19+
assert is_not_empty(full1);
20+
assert is_not_empty(full2);
21+
}
22+
823
#[test]
924
fn test_from_vec() {
1025
let l = from_vec([0, 1, 2]);

0 commit comments

Comments
 (0)