mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
parent
68cc9312c8
commit
9651cff6c0
2 changed files with 102 additions and 22 deletions
|
@ -1,4 +1,5 @@
|
|||
use crate::common::util::*;
|
||||
use uucore::display::Quotable;
|
||||
// spell-checker:ignore (ToDO) taaaa tbbbb tcccc
|
||||
|
||||
#[test]
|
||||
|
@ -179,6 +180,14 @@ fn test_tabs_must_be_ascending() {
|
|||
.stderr_contains("tab sizes must be ascending");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tabs_cannot_be_zero() {
|
||||
new_ucmd!()
|
||||
.arg("--tabs=0")
|
||||
.fails()
|
||||
.stderr_contains("tab size cannot be 0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tabs_keep_last_trailing_specifier() {
|
||||
// If there are multiple trailing specifiers, use only the last one
|
||||
|
@ -200,3 +209,31 @@ fn test_tabs_comma_separated_no_numbers() {
|
|||
.succeeds()
|
||||
.stdout_is(" a b c");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tabs_with_specifier_not_at_start() {
|
||||
fn run_cmd(arg: &str, expected_prefix: &str, expected_suffix: &str) {
|
||||
let expected_msg = format!(
|
||||
"{} specifier not at start of number: {}",
|
||||
expected_prefix.quote(),
|
||||
expected_suffix.quote()
|
||||
);
|
||||
new_ucmd!().arg(arg).fails().stderr_contains(expected_msg);
|
||||
}
|
||||
run_cmd("--tabs=1/", "/", "/");
|
||||
run_cmd("--tabs=1/2", "/", "/2");
|
||||
run_cmd("--tabs=1+", "+", "+");
|
||||
run_cmd("--tabs=1+2", "+", "+2");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tabs_with_invalid_chars() {
|
||||
new_ucmd!()
|
||||
.arg("--tabs=x")
|
||||
.fails()
|
||||
.stderr_contains("tab size contains invalid character(s): 'x'");
|
||||
new_ucmd!()
|
||||
.arg("--tabs=1x2")
|
||||
.fails()
|
||||
.stderr_contains("tab size contains invalid character(s): 'x2'");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue