blob: f059ea0ecd97e4f4a190019c6fbfc1cfd5d65efd (
plain)
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
|
use calendars;
use KhResult;
pub fn action_get(args: &[&str]) -> KhResult<()> {
if args.is_empty() {
Err("get calendars")?;
}
match args[0] {
"calendars" => action_get_calendars(),
_ => Err("Unknown get parameter!")?
}
}
pub fn action_get_calendars() -> KhResult<()> {
for calendar in calendars::calendar_list() {
khprintln!("{}", calendar);
}
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
use testutils;
use utils::stdioutils;
#[test]
fn test_get_calendars() {
let _testdir = testutils::prepare_testdir("testdir_two_cals");
action_get(&["calendars"]).unwrap();
assert_eq!("first\nsecond\nsecond/second_sub\n", stdioutils::test_stdout_clear());
}
}
|