Commit graph

188 commits

Author SHA1 Message Date
Daniel Hofstetter
0ec6802459 ls: fix padding of size column when using -l 2023-11-30 16:19:27 +01:00
Daniel Hofstetter
2f9fcf73fa clippy: fix warnings introduced by Rust 1.74 2023-11-16 16:21:28 +01:00
Terts Diepraam
96d0830952
Merge pull request #5446 from cakebaker/ls_try_get_matches_from
ls: use try_get_matches_from instead of get_matches_from
2023-10-25 11:25:40 +02:00
Daniel Hofstetter
6f84e56e28 ls: return exit code 2 for invalid time-style 2023-10-24 16:33:04 +02:00
Daniel Hofstetter
fd18d2686f ls: return exit code 2 for -l --dired --zero 2023-10-24 14:48:24 +02:00
Sylvestre Ledru
f971a69d69
ls --dired -R: fix the positions (#5341)
* move get_offset_from_previous_line into a specific function

* dired: improve the -R support

* dired: fix the display with subdir

* ls --dired -R: fix the positions

* ls --dired -R: verify also the SUBDIRED coordinate

* ls --dired -R: add a long file name and fix a windows test

* dired: always put dired first in the args + minor fixes

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* ls: add cognitive_complexity to silent a warning

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-10-19 14:17:34 +02:00
Sylvestre Ledru
41188a915e
rename the test
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-10-13 11:35:45 +02:00
Sylvestre Ledru
94972d45c7 ls: Document a bit tests/ls/stat-dtype.sh 2023-10-12 23:37:07 +02:00
Sylvestre Ledru
7337cd5169 ls -R1: add a test to replicate GNU's recursive.sh 2023-10-01 17:03:57 +02:00
Daniel Hofstetter
0794d1338d ls: fix test which fails if /tmp uses tmpfs 2023-09-22 10:43:23 +02:00
Sylvestre Ledru
9b4d2c6bc4
ls: implement --dired
* Support ls --dired

* stat-failed.sh: update of the test - we have a small difference

* ls --dired: address some of the comments

* fix warnings

* use unwrap()

* Improve test

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* Simplify test

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* Remove a word from the spell ignore

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* remove duplication of the spell ignore

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* rustfmt

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-09-20 08:17:46 +02:00
Sylvestre Ledru
37ee889003 ls -l: show an error when symlink not readable
switching to match and handle the error

Will help with tests/ls/stat-failed.sh
2023-09-15 22:34:17 +02:00
Sylvestre Ledru
bfca6bf70f Add license headers on all files 2023-08-21 10:49:27 +02:00
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