diff --git a/tests/fixtures/fmt/one-word-per-line.txt b/tests/fixtures/fmt/one-word-per-line.txt new file mode 100644 index 000000000..2f5f5b11e --- /dev/null +++ b/tests/fixtures/fmt/one-word-per-line.txt @@ -0,0 +1,9 @@ +this +is +a +file +with +one +word +per +line diff --git a/tests/test_fmt.rs b/tests/test_fmt.rs new file mode 100644 index 000000000..bf18b4534 --- /dev/null +++ b/tests/test_fmt.rs @@ -0,0 +1,37 @@ +use common::util::*; + +#[test] +fn test_fmt() { + let result = new_ucmd!().arg("one-word-per-line.txt").run(); + //.stdout_is_fixture("call_graph.expected"); + assert_eq!( + result.stdout.trim(), + "this is a file with one word per line" + ); +} + +#[test] +fn test_fmt_q() { + let result = new_ucmd!().arg("-q").arg("one-word-per-line.txt").run(); + //.stdout_is_fixture("call_graph.expected"); + assert_eq!( + result.stdout.trim(), + "this is a file with one word per line" + ); +} + +/* #[test] + Fails for now, see https://github.com/uutils/coreutils/issues/1501 +fn test_fmt_w() { + let result = new_ucmd!() + .arg("-w") + .arg("10") + .arg("one-word-per-line.txt") + .run(); + //.stdout_is_fixture("call_graph.expected"); + assert_eq!(result.stdout.trim(), "this is a file with one word per line"); +} + + +fmt is pretty broken in general, needs more works to have more tests + */ diff --git a/tests/tests.rs b/tests/tests.rs index 4db11f523..ead3b68f9 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -64,6 +64,7 @@ generic! { "expr", test_expr; "factor", test_factor; "false", test_false; + "fmt", test_fmt; "fold", test_fold; "hashsum", test_hashsum; "head", test_head;