mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 23:32:39 +00:00
45 lines
1.1 KiB
Rust
45 lines
1.1 KiB
Rust
use crate::common::util::TestScenario;
|
|
|
|
#[test]
|
|
fn test_invalid_arg() {
|
|
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
|
}
|
|
|
|
#[test]
|
|
fn test_fmt() {
|
|
new_ucmd!()
|
|
.arg("one-word-per-line.txt")
|
|
.succeeds()
|
|
.stdout_is("this is a file with one word per line\n");
|
|
}
|
|
|
|
#[test]
|
|
fn test_fmt_quick() {
|
|
for param in ["-q", "--quick"] {
|
|
new_ucmd!()
|
|
.args(&["one-word-per-line.txt", param])
|
|
.succeeds()
|
|
.stdout_is("this is a file with one word per line\n");
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn test_fmt_width() {
|
|
for param in ["-w", "--width"] {
|
|
new_ucmd!()
|
|
.args(&["one-word-per-line.txt", param, "10"])
|
|
.succeeds()
|
|
.stdout_is("this is\na file\nwith one\nword per\nline\n");
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn test_fmt_width_too_big() {
|
|
for param in ["-w", "--width"] {
|
|
new_ucmd!()
|
|
.args(&["one-word-per-line.txt", param, "2501"])
|
|
.fails()
|
|
.code_is(1)
|
|
.stderr_is("fmt: invalid width: '2501': Numerical result out of range\n");
|
|
}
|
|
}
|