Commit graph

175 commits

Author SHA1 Message Date
Rayhan Faizel
9e26534239 tests/ls: Test overflowing decimal and octal values of --width 2023-07-12 23:24:26 +05:30
John Shin
4db5a60667 ls: add back version cmp test 2023-07-09 15:30:56 -07:00
Daniel Hofstetter
0b37b63ea3
Merge pull request #5055 from yt2b/ls_literal_option
ls: --l should output the same as --literal
2023-07-09 14:07:24 +02:00
yt2b
cf6f7856e4 ls: fix --l option 2023-07-08 10:43:20 +09:00
John Shin
b42a5b8741 ls: update test result for version compare 2023-07-05 10:05:52 +02:00
Guillaume Ranquet
80c7ed9732 ls: force fetching metadata when called with -L -Z
The metadata are not used but it permits to check the symlink is valid.
We then return 1 on invalid symlinks when ls is invoked with ls -L -Z

Signed-off-by: Guillaume Ranquet <granquet@baylibre.com>
2023-06-26 14:46:56 +02:00
Daniel Hofstetter
c26396087f
ls: add words to spell-checker:ignore 2023-06-06 17:44:04 +02:00
Rayhan Faizel
21f1a119c3 tests/ls: Implement tests for sort by width option 2023-06-06 20:56:42 +05:30
Sylvestre Ledru
3e7594632b ls: when facing an invalid utf-8, don't panic
Fails with
```
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "invalid-\xE0-"', src/uu/ls/src/ls.rs:1932:53
```
2023-05-14 22:11:44 +02:00
Daniel Hofstetter
98fa941250
Merge pull request #4759 from sylvestre/clippy4
fix some clippy warnings in tests
2023-05-12 07:15:44 +02:00
SteveLauC
452be5a220
ls: device number for BSDs and solarishOS (#4841) 2023-05-11 12:58:36 +02:00
Niyaz Nigmatullin
467cbf30de [tests/ls] Support user names containing dots
- Fix regex's in tests for `ls -l`
2023-04-27 18:27:48 +03:00
Dan Gohman
eba000ddcc Use expected_result in test_ls to avoid spurious failures
As the existing comment says, the expected output here is dependent on
the platform, so use the `expected_result` utility to avoid hard-coding
specific results for each platform.

This fixes spurious failures on my machine.
2023-04-25 05:40:37 -07:00
Sylvestre Ledru
efa361dd7c Fix some trivial clippy warnings 2023-04-20 23:22:05 +02:00
Daniel Hofstetter
7a888da409 tests: remove all "extern crate" statements 2023-04-10 08:31:31 +02:00
Piotr Kwiecinski
51d39c8bb7 test_ls: cannot find function expected_result in this scope 2023-03-23 09:18:17 +01:00
Daniel Hofstetter
6988eb7ec6 tests: expand wildcard imports 2023-03-20 15:32:35 +01:00
Parag Jain
50e019a711 Fixing failing test locally because of missing case sensitivity handling 2023-03-14 12:28:49 -04:00
Thayne McCombs
17f9507e17 Add tests for non-utf8 2023-02-21 22:58:39 -07:00
Joining7943
f610f33aa7
tests/util: Don't trim output in CmdResult::stdout_matches and stdout_does_not_match (#4304)
* tests/util: Fix documentation of UCommand::stderr_only and usage_error

* tests/util: Remove trimming from CmdResult::stdout_matches and stdout_does_not_match. Fix tests.

The tests are fixed to match the trailing newline instead of ignoring it.
2023-02-16 15:33:33 +01:00
Daniel Hofstetter
f6b646e4e5 clippy: fix warnings introduced with Rust 1.67.0 2023-01-27 17:37:56 +01:00
Joining7943
1fadeb43b2 tests/util: Do not trim stderr in CmdResult::stderr_is. Add method stderr_trimmed_is.
Fix tests assert whitespace instead of trimming it. Disable some tests in `test_tr` because `tr`
produces too many newlines.
2023-01-22 14:56:19 +01:00
Daniel Hofstetter
9a2174ba02 chore: standardize creation of empty strings 2022-12-01 13:49:23 +01:00
Niyaz Nigmatullin
fdd6a05259 chore: run cargo +nightly clippy --fix 2022-11-16 11:09:44 +02:00
Jeffrey Finkelstein
55b3766c10 clippy fixes 2022-10-23 13:56:20 -04:00
Sylvestre Ledru
e4fe2b10fa
Merge pull request #4014 from tertsdiepraam/ls-windows-permissions
`ls`, `stat`: Show more info in long format on Windows
2022-10-22 10:21:43 +02:00
Terts Diepraam
c6cff20f18 ls: update to clap 4 2022-10-13 17:50:36 +02:00
Sylvestre Ledru
6e14dea73b Fix some clippy warnings
Fixed with `cargo clippy --features unix  --fix`
and manually
2022-10-13 09:07:22 +02:00
Sylvestre Ledru
538e8eca0b
Fix coding style 2022-10-09 20:03:06 +02:00
Terts Diepraam
b3e6472d02 test_ls: adapt to new windows permissions 2022-10-09 12:03:44 +02:00
Ackerley Tng
d84803b72f ls: align --ignore behavior with that of GNU ls 2022-10-08 16:54:07 -07:00
David Matos
b8a5588b81 ls: add support for +FORMAT in timestyle 2022-10-05 13:29:19 +02:00
Terts Diepraam
e377e4f046 dd: custom positional argument parsing 2022-09-21 18:41:12 +02:00
Niyaz Nigmatullin
8bd9427d0d tests/ls: added exit code to some test failures 2022-09-12 19:47:16 +03:00
Niyaz Nigmatullin
306272bf60 unix_sockets is deprecated, use std::os::unix::net instead 2022-08-20 17:02:29 +03:00
Jan Scheer
391709c911
tests: ignore failing tests for FreeBSD (#3778) 2022-08-13 10:09:05 +02:00
Pierre Marsais
4ad0d5c5a3
ls: Implement --zero flag. (#2929) (#3746)
* ls: Implement --zero flag. (#2929)

This flag can be used to provide a easy machine parseable output from
ls, as discussed in the GNU bug report
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49716.

There are some peculiarities with this flag:

 - Current implementation of GNU ls of the `--zero` flag implies some
   other flags. Those can be overridden by setting those flags after
   `--zero` in the command line.
 - This flag is not compatible with `--dired`. This patch is not 100%
   compliant with GNU ls: GNU ls `--zero` will fail if `--dired` and
   `-l` are set, while with this patch only `--dired` is needed for the
   command to fail.

We also add `--dired` flag to the parser, with no additional behaviour
change.

Testing done:
```
$ bash util/build-gnu.sh
 [...]
$ bash util/run-gnu-test.sh tests/ls/zero-option.sh
 [...]
 PASS: tests/ls/zero-option.sh
 ============================================================================
 Testsuite summary for GNU coreutils 9.1.36-8ec11
 ============================================================================
 # TOTAL: 1
 # PASS:  1
 # SKIP:  0
 # XFAIL: 0
 # FAIL:  0
 # XPASS: 0
 # ERROR: 0
 ============================================================================
```

* Use the US way to spell Behavior

* Fix formatting with cargo fmt -- tests/by-util/test_ls.rs

* Simplify --zero flag overriding logic by using index_of

Also, allow multiple --zero flags, as this is possible with GNU ls
command. Only the last one is taken into account.

Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
2022-07-31 19:02:50 +02:00
Sam Nystrom
4e72e284b5
ls: silently ignore -T option (#3718)
* ls: silently ignore `-T` option
2022-07-26 10:35:43 +02:00
Sylvestre Ledru
882cd527ff
Merge pull request #3704 from Sciencentistguy/once_cell
Replace lazy_static with once_cell
2022-07-13 16:15:47 +02:00
Jamie Quigley
1a270361c0
Replace lazy_static with once_cell 2022-07-12 14:08:30 +01:00
Niyaz Nigmatullin
da5808d4ac
ls: add already listed message (#3707)
* ls: handle looping symlinks infinite printing

* ls: better coloring and printing symlinks when dereferenced

* tests/ls: add dereferencing and symlink loop tests

* ls: reformat changed using rustfmt

* ls: follow clippy advice for cleaner code

* uucore/fs: fix FileInformation to open directory handles in Windows as
well
2022-07-11 17:18:58 +02:00
anastygnome
0ef6732632
Add a test like the one in the issue.
Signed-off-by: anastygnome <noreplygitemail@protonmail.com>
2022-06-13 11:29:13 +02:00
Joerg Jaspert
fd1e0e6dd7 Correctly parse numbers starting with 0 as octal 2022-06-12 12:55:33 +02:00
Joerg Jaspert
c513692bae Test for (against) octal-looking width 2022-06-11 22:43:46 +02:00
Terts Diepraam
626ed43e05 ls: fix double quoting when color is enabled
When color was enabled the escape_name function was called twice which led to names like `hello world` being displayed as `"'hello world'".
2022-06-03 00:29:56 +02:00
Thomas Queiroz
0b24839a1e
tests/ls: add --group-directories-first test 2022-05-21 18:57:53 -03:00
Thomas Queiroz
c4606266e4
tests/ls: update version sort test 2022-05-21 18:50:26 -03:00
Jeffrey Finkelstein
896bbec760 all: clippy fixes 2022-05-13 22:47:56 -04:00
Justin Tracey
2a0d58d060 get android builds to compile and pass tests 2022-04-20 08:44:49 +02:00
Sylvestre Ledru
d0aa9a9927
Merge pull request #3343 from uutils/dependabot/cargo/lscolors-0.9.0
build(deps): bump lscolors from 0.7.1 to 0.9.0
2022-04-09 09:29:25 +02:00