2020-05-25 17:05:26 +00:00
|
|
|
use crate::common::util::*;
|
2020-05-05 21:15:50 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_fmt() {
|
|
|
|
let result = new_ucmd!().arg("one-word-per-line.txt").run();
|
|
|
|
//.stdout_is_fixture("call_graph.expected");
|
|
|
|
assert_eq!(
|
2021-04-05 20:03:43 +00:00
|
|
|
result.stdout_str().trim(),
|
2020-05-05 21:15:50 +00:00
|
|
|
"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!(
|
2021-04-05 20:03:43 +00:00
|
|
|
result.stdout_str().trim(),
|
2020-05-05 21:15:50 +00:00
|
|
|
"this is a file with one word per line"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-01-24 21:41:05 +00:00
|
|
|
#[test]
|
|
|
|
fn test_fmt_w_too_big() {
|
|
|
|
let result = new_ucmd!()
|
|
|
|
.arg("-w")
|
|
|
|
.arg("2501")
|
|
|
|
.arg("one-word-per-line.txt")
|
|
|
|
.run();
|
|
|
|
//.stdout_is_fixture("call_graph.expected");
|
|
|
|
assert_eq!(
|
2021-04-22 20:37:44 +00:00
|
|
|
result.stderr_str().trim(),
|
2021-05-25 23:45:53 +00:00
|
|
|
"fmt: invalid width: '2501': Numerical result out of range"
|
2021-01-24 21:41:05 +00:00
|
|
|
);
|
|
|
|
}
|
2021-05-05 21:12:17 +00:00
|
|
|
#[test]
|
2020-05-05 21:15:50 +00:00
|
|
|
fn test_fmt_w() {
|
|
|
|
let result = new_ucmd!()
|
|
|
|
.arg("-w")
|
|
|
|
.arg("10")
|
|
|
|
.arg("one-word-per-line.txt")
|
|
|
|
.run();
|
2021-05-05 21:12:17 +00:00
|
|
|
//.stdout_is_fixture("call_graph.expected");
|
|
|
|
assert_eq!(
|
|
|
|
result.stdout_str().trim(),
|
|
|
|
"this is\na file\nwith one\nword per\nline"
|
|
|
|
);
|
2020-05-05 21:15:50 +00:00
|
|
|
}
|