mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
Merge pull request #1504 from sylvestre/fmt
test(fmt): add some small initial tests
This commit is contained in:
commit
7b96432eff
3 changed files with 47 additions and 0 deletions
9
tests/fixtures/fmt/one-word-per-line.txt
vendored
Normal file
9
tests/fixtures/fmt/one-word-per-line.txt
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
this
|
||||||
|
is
|
||||||
|
a
|
||||||
|
file
|
||||||
|
with
|
||||||
|
one
|
||||||
|
word
|
||||||
|
per
|
||||||
|
line
|
37
tests/test_fmt.rs
Normal file
37
tests/test_fmt.rs
Normal file
|
@ -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
|
||||||
|
*/
|
|
@ -64,6 +64,7 @@ generic! {
|
||||||
"expr", test_expr;
|
"expr", test_expr;
|
||||||
"factor", test_factor;
|
"factor", test_factor;
|
||||||
"false", test_false;
|
"false", test_false;
|
||||||
|
"fmt", test_fmt;
|
||||||
"fold", test_fold;
|
"fold", test_fold;
|
||||||
"hashsum", test_hashsum;
|
"hashsum", test_hashsum;
|
||||||
"head", test_head;
|
"head", test_head;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue