summaryrefslogtreecommitdiffstats
path: root/src/actions/show.rs
blob: 00f4626c602a67d77a38eaaaea1d4838417bd021 (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
use input;
use utils::fileutil;
use KhResult;

pub fn do_show(_args: &[&str]) -> KhResult<()> {
  info!("do_show");
  let lines = input::default_input_khlines()?;

  for line in lines {
    let output = fileutil::read_file_to_string(line.get_path()).unwrap();
    khprintln!("{}", output);
  }

  Ok(())
}

#[cfg(test)]
mod tests {
  use super::*;

  use testutils::*;
  use utils::stdioutils::*;

  #[test]
  fn test_() {
    let _testdir = prepare_testdir("testdir_with_seq");

    do_show(&[]).unwrap();

    let stdout = test_stdout_clear();
    assert_eq!(784, stdout.len());
    assert_eq!(32, stdout.lines().count());
  }
}