Make store list work.
This commit is contained in:
parent
c26089caed
commit
933d48a47c
@ -32,7 +32,12 @@ impl Store {
|
||||
}
|
||||
|
||||
pub fn list(&self) -> Vec<String> {
|
||||
Vec::new()
|
||||
let mut names = Vec::new();
|
||||
for name in self.data.keys() {
|
||||
names.push(name.to_string());
|
||||
}
|
||||
names.sort();
|
||||
names
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,4 +95,15 @@ mod storage {
|
||||
None => Ok(()),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn get_list() {
|
||||
let mut store = Store::new();
|
||||
let mut ids = ["one", "two", "three", "four", "five"];
|
||||
for name in ids {
|
||||
store.add(name.to_string()).unwrap();
|
||||
}
|
||||
ids.sort();
|
||||
assert_eq!(store.list(), ids);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user