1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
pub struct Paths {
pub list: Vec<String>,
}
impl Paths {
pub fn top() -> Self {
Self::from(vec![])
}
pub fn from(fields: Vec<String>) -> Self {
Paths { list: fields }
}
pub fn into_inner(self) -> Vec<String> {
self.list
}
}
#[cfg(test)]
mod test {
use super::Paths;
#[test]
fn paths_top() {
assert!(Paths::top().into_inner().is_empty());
}
#[test]
fn paths_from() {
assert_eq!(
Paths::from(vec!["level1".to_string()]).into_inner(),
["level1"]
);
}
}