diff --git a/TODO.md b/TODO.md index 43cb7c9..09da2cc 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,6 @@ - 1. parse cli parameters - 2. read from stdin - 3. split stdin into columns (column/awk commands) + 1.  parse cli parameters + 2.  read from stdin + 3.  split stdin into columns 3. map (execute) commands to fields - [ ] execute a command on first text column 4. print resulting concatenated columns diff --git a/src/main.rs b/src/main.rs index ae3bd2c..c3a9fed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -104,19 +104,9 @@ fn main() -> Result<()> { assert!(input_text.n_cols()? >= cli.yargs.len()); - - - // TODO: RESULT print!("{}", raw_input); - - - // - // cmd.error(ErrorKind::ValueValidation, "invalid") - // .exit() - // validate number of Ok(()) } - diff --git a/tests/cli.rs b/tests/cli.rs index 2267127..2ab90c8 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -1,5 +1,3 @@ -//TODO: - use std::error::Error; use assert_cmd::Command; // use assert_cmd::prelude::*; @@ -52,3 +50,15 @@ fn fail_yargs_mismatch1() -> TestResult { } +// n args <= n cols +#[test] +fn cli_pass2() -> TestResult { + run_args("tests/inputs/input1", &["1", "2", "3", "4", "5", "6"]) +} + +#[test] +#[should_panic] +// more arguments passed than columns +fn cli_fail1() { + run_args("tests/inputs/input1", &["1", "2", "3", "4", "5", "6", "7", "8"]).unwrap() +}