mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Add tests for non-utf8
This commit is contained in:
parent
3acd75bcc4
commit
17f9507e17
9 changed files with 170 additions and 126 deletions
|
@ -609,10 +609,10 @@ fn test_ls_a() {
|
|||
fn test_ls_width() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.touch(&at.plus_as_string("test-width-1"));
|
||||
at.touch(&at.plus_as_string("test-width-2"));
|
||||
at.touch(&at.plus_as_string("test-width-3"));
|
||||
at.touch(&at.plus_as_string("test-width-4"));
|
||||
at.touch(at.plus_as_string("test-width-1"));
|
||||
at.touch(at.plus_as_string("test-width-2"));
|
||||
at.touch(at.plus_as_string("test-width-3"));
|
||||
at.touch(at.plus_as_string("test-width-4"));
|
||||
|
||||
for option in [
|
||||
"-w 100",
|
||||
|
@ -692,10 +692,10 @@ fn test_ls_width() {
|
|||
fn test_ls_columns() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.touch(&at.plus_as_string("test-columns-1"));
|
||||
at.touch(&at.plus_as_string("test-columns-2"));
|
||||
at.touch(&at.plus_as_string("test-columns-3"));
|
||||
at.touch(&at.plus_as_string("test-columns-4"));
|
||||
at.touch(at.plus_as_string("test-columns-1"));
|
||||
at.touch(at.plus_as_string("test-columns-2"));
|
||||
at.touch(at.plus_as_string("test-columns-3"));
|
||||
at.touch(at.plus_as_string("test-columns-4"));
|
||||
|
||||
// Columns is the default
|
||||
let result = scene.ucmd().succeeds();
|
||||
|
@ -753,10 +753,10 @@ fn test_ls_columns() {
|
|||
fn test_ls_across() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.touch(&at.plus_as_string("test-across-1"));
|
||||
at.touch(&at.plus_as_string("test-across-2"));
|
||||
at.touch(&at.plus_as_string("test-across-3"));
|
||||
at.touch(&at.plus_as_string("test-across-4"));
|
||||
at.touch(at.plus_as_string("test-across-1"));
|
||||
at.touch(at.plus_as_string("test-across-2"));
|
||||
at.touch(at.plus_as_string("test-across-3"));
|
||||
at.touch(at.plus_as_string("test-across-4"));
|
||||
|
||||
for option in ACROSS_ARGS {
|
||||
let result = scene.ucmd().arg(option).succeeds();
|
||||
|
@ -781,10 +781,10 @@ fn test_ls_across() {
|
|||
fn test_ls_commas() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.touch(&at.plus_as_string("test-commas-1"));
|
||||
at.touch(&at.plus_as_string("test-commas-2"));
|
||||
at.touch(&at.plus_as_string("test-commas-3"));
|
||||
at.touch(&at.plus_as_string("test-commas-4"));
|
||||
at.touch(at.plus_as_string("test-commas-1"));
|
||||
at.touch(at.plus_as_string("test-commas-2"));
|
||||
at.touch(at.plus_as_string("test-commas-3"));
|
||||
at.touch(at.plus_as_string("test-commas-4"));
|
||||
|
||||
for option in COMMA_ARGS {
|
||||
let result = scene.ucmd().arg(option).succeeds();
|
||||
|
@ -814,8 +814,8 @@ fn test_ls_zero() {
|
|||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.mkdir("0-test-zero");
|
||||
at.touch(&at.plus_as_string("2-test-zero"));
|
||||
at.touch(&at.plus_as_string("3-test-zero"));
|
||||
at.touch(at.plus_as_string("2-test-zero"));
|
||||
at.touch(at.plus_as_string("3-test-zero"));
|
||||
|
||||
let ignored_opts = [
|
||||
"--quoting-style=c",
|
||||
|
@ -870,7 +870,7 @@ fn test_ls_zero() {
|
|||
|
||||
#[cfg(unix)]
|
||||
{
|
||||
at.touch(&at.plus_as_string("1\ntest-zero"));
|
||||
at.touch(at.plus_as_string("1\ntest-zero"));
|
||||
|
||||
let ignored_opts = [
|
||||
"--quoting-style=c",
|
||||
|
@ -933,9 +933,9 @@ fn test_ls_zero() {
|
|||
fn test_ls_commas_trailing() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.touch(&at.plus_as_string("test-commas-trailing-2"));
|
||||
at.touch(at.plus_as_string("test-commas-trailing-2"));
|
||||
|
||||
at.touch(&at.plus_as_string("test-commas-trailing-1"));
|
||||
at.touch(at.plus_as_string("test-commas-trailing-1"));
|
||||
at.append(
|
||||
"test-commas-trailing-1",
|
||||
&(0..2000)
|
||||
|
@ -957,7 +957,7 @@ fn test_ls_commas_trailing() {
|
|||
fn test_ls_long() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.touch(&at.plus_as_string("test-long"));
|
||||
at.touch(at.plus_as_string("test-long"));
|
||||
|
||||
for arg in LONG_ARGS {
|
||||
let result = scene.ucmd().arg(arg).arg("test-long").succeeds();
|
||||
|
@ -975,7 +975,7 @@ fn test_ls_long_format() {
|
|||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.mkdir(&at.plus_as_string("test-long-dir"));
|
||||
at.touch(&at.plus_as_string("test-long-dir/test-long-file"));
|
||||
at.touch(at.plus_as_string("test-long-dir/test-long-file"));
|
||||
at.mkdir(&at.plus_as_string("test-long-dir/test-long-dir"));
|
||||
|
||||
for arg in LONG_ARGS {
|
||||
|
@ -1231,9 +1231,9 @@ fn test_ls_long_symlink_color() {
|
|||
fn test_ls_long_total_size() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.touch(&at.plus_as_string("test-long"));
|
||||
at.touch(at.plus_as_string("test-long"));
|
||||
at.append("test-long", "1");
|
||||
at.touch(&at.plus_as_string("test-long2"));
|
||||
at.touch(at.plus_as_string("test-long2"));
|
||||
at.append("test-long2", "2");
|
||||
|
||||
let expected_prints: HashMap<_, _> = if cfg!(unix) {
|
||||
|
@ -1275,7 +1275,7 @@ fn test_ls_long_total_size() {
|
|||
fn test_ls_long_formats() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.touch(&at.plus_as_string("test-long-formats"));
|
||||
at.touch(at.plus_as_string("test-long-formats"));
|
||||
|
||||
// Zero or one "." for indicating a file with security context
|
||||
|
||||
|
@ -1422,8 +1422,8 @@ fn test_ls_long_formats() {
|
|||
fn test_ls_oneline() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.touch(&at.plus_as_string("test-oneline-1"));
|
||||
at.touch(&at.plus_as_string("test-oneline-2"));
|
||||
at.touch(at.plus_as_string("test-oneline-1"));
|
||||
at.touch(at.plus_as_string("test-oneline-2"));
|
||||
|
||||
// Bit of a weird situation: in the tests oneline and columns have the same output,
|
||||
// except on Windows.
|
||||
|
@ -1443,7 +1443,7 @@ fn test_ls_deref() {
|
|||
let path_regexp = r"(.*)test-long.link -> (.*)test-long(.*)";
|
||||
let re = Regex::new(path_regexp).unwrap();
|
||||
|
||||
at.touch(&at.plus_as_string("test-long"));
|
||||
at.touch(at.plus_as_string("test-long"));
|
||||
at.symlink_file("test-long", "test-long.link");
|
||||
assert!(at.is_symlink("test-long.link"));
|
||||
|
||||
|
@ -1808,8 +1808,8 @@ fn test_ls_files_dirs() {
|
|||
at.mkdir("a/b");
|
||||
at.mkdir("a/b/c");
|
||||
at.mkdir("z");
|
||||
at.touch(&at.plus_as_string("a/a"));
|
||||
at.touch(&at.plus_as_string("a/b/b"));
|
||||
at.touch(at.plus_as_string("a/a"));
|
||||
at.touch(at.plus_as_string("a/b/b"));
|
||||
|
||||
scene.ucmd().arg("a").succeeds();
|
||||
scene.ucmd().arg("a/a").succeeds();
|
||||
|
@ -1840,8 +1840,8 @@ fn test_ls_recursive() {
|
|||
at.mkdir("a/b");
|
||||
at.mkdir("a/b/c");
|
||||
at.mkdir("z");
|
||||
at.touch(&at.plus_as_string("a/a"));
|
||||
at.touch(&at.plus_as_string("a/b/b"));
|
||||
at.touch(at.plus_as_string("a/a"));
|
||||
at.touch(at.plus_as_string("a/b/b"));
|
||||
|
||||
scene.ucmd().arg("a").succeeds();
|
||||
scene.ucmd().arg("a/a").succeeds();
|
||||
|
@ -1880,7 +1880,7 @@ fn test_ls_color() {
|
|||
.join("nested_file")
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
at.touch(&nested_file);
|
||||
at.touch(nested_file);
|
||||
at.touch("test-color");
|
||||
|
||||
let a_with_colors = "\x1b[1;34ma\x1b[0m";
|
||||
|
@ -1985,7 +1985,7 @@ fn test_ls_indicator_style() {
|
|||
at.mkdir("directory");
|
||||
assert!(at.dir_exists("directory"));
|
||||
|
||||
at.touch(&at.plus_as_string("link-src"));
|
||||
at.touch(at.plus_as_string("link-src"));
|
||||
at.symlink_file("link-src", "link-dest.link");
|
||||
assert!(at.is_symlink("link-dest.link"));
|
||||
|
||||
|
@ -2077,7 +2077,7 @@ fn test_ls_indicator_style() {
|
|||
at.mkdir("directory");
|
||||
assert!(at.dir_exists("directory"));
|
||||
|
||||
at.touch(&at.plus_as_string("link-src"));
|
||||
at.touch(at.plus_as_string("link-src"));
|
||||
at.symlink_file("link-src", "link-dest.link");
|
||||
assert!(at.is_symlink("link-dest.link"));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue