Commit Graph
65 Commits
Author SHA1 Message Date
xtqqczzeandDaniel Hofstetter c2acff22ee clippy: fix items_after_statements lint
https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
2026-04-28 09:37:21 +02:00
AnthonyandGitHub 36ac85b1f3 tests: add WASI integration test support via wasmtime 2026-04-12 15:19:04 +02:00
mattsuandGitHub 2b10153e21 wc: stop processing --files0-from input after stdout write failure (#11023)
* fix(wc): stop processing after stdout write error

When wc encounters a write error to stdout (e.g., when stdout is redirected to /dev/full), it should stop processing immediately rather than continuing to process remaining files. This matches GNU wc behavior and prevents unnecessary processing after the output is already broken.

* fix(wc): improve error message matching in test_files0_stops_after_stdout_write_error
2026-02-19 09:33:42 +01:00
DhruvandGitHub f388214d47 wc: fix word undercount with invalid byte sequences (#10348)
* wc: fix word undercount with invalid byte sequences

* wc: update utf8 test counts to account invalid byte sequences

* wc: remove unnecessary borrow in test
2026-01-21 06:26:53 -08:00
DhruvandGitHub a74f72f390 wc: respect POSIXLY_CORRECT for word counting (#10344)
* wc: respect POSIXLY_CORRECT for word counting

* wc: Add test for POSIXLY_CORRECT word counting
2026-01-20 16:18:55 +01:00
238b27eddf wc:Ensure the output order of stdout and stderror remains unchanged. (#9905)
---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2026-01-18 18:57:37 +01:00
da543cb76e fix(wc):GNU wc-cpu.sh (#9144)
* wc: align SIMD policy integration

- use SimdPolicy::detect with hardware feature labeling
- keep SIMD behavior respecting GLIBC_TUNABLES
- consolidate wc SIMD debug output and tests

* refactor(wc): simplify SIMD feature collection in debug output

- Changed multi-line SIMD feature vector creation to a single-line expression for improved readability and consistency with surrounding code.
- No functional changes; only stylistic refactoring in the wc debug logic.

* feat(wc): enhance debug output for SIMD hardware support limitations

Add new localization strings and logic to provide detailed debug information when SIMD support is limited by GLIBC_TUNABLES, including lists of disabled and enabled features. Refactor SIMD allowance check for better accuracy in detecting runtime support.

* refactor: consolidate SIMD feature handling in wc command

Refactor SIMD feature detection and reporting in the wc utility by introducing a WcSimdFeatures struct to group enabled, disabled, and runtime-disabled features. This replaces multiple separate functions with a single function, improving code organization and efficiency by reducing redundant iterations over feature lists. Also rename helper functions for clarity and update debug output logic accordingly.

* Update src/uu/wc/src/wc.rs

Co-authored-by: Dorian Péron <72708393+RenjiSann@users.noreply.github.com>

* Update src/uu/wc/locales/en-US.ftl

Co-authored-by: Dorian Péron <72708393+RenjiSann@users.noreply.github.com>

* Update src/uu/wc/locales/fr-FR.ftl

Co-authored-by: Dorian Péron <72708393+RenjiSann@users.noreply.github.com>

* feat(wc): import show_error for enhanced error reporting

Add the show_error import from uucore to enable better error handling in the wc utility, allowing for consistent error messages in line with the project's style.

---------

Co-authored-by: Dorian Péron <72708393+RenjiSann@users.noreply.github.com>
2025-12-27 01:06:08 +01:00
Daniel Hofstetter 905714ca79 wc: adapt error message to pass wc-files0-from 2025-09-26 17:46:59 +02:00
5d9afe8bc7 add tests with emoji for various commands (#8545)
* add tests with emoji for various commands

* test/ls: use touch instead of an empty write

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

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-09-03 09:57:04 +02:00
3b4b769976 tests: fix execution on WSL2, Ubuntu 24.04 (#8235)
* tests: fix execution on WSL2, Ubuntu 24.04

Skip incompatible parts of tests to ensure that
    cargo nextest run --features unix
executes successfully in WSL2, Ubuntu 24.04 distribution.

Changes
* Skip tests that required sys/kernel/profiling which is not
available in WSL2 default configuration.
* Use timezones in tests that are part of the standard tzdata
list and not only available in backwards list. Backwards list is
not installed by default in Ubuntu 24.04 (package tzdata-legacy).
* check that /proc/modules is not empty when expecting content,
because it is empty in WSL2 default configuration.
* Skip logname test not only in WSL1, also in WSL2.

* Add workflow for WSL2

This will setup WSL2 on windows-latest runner, install
Ubuntu-24.04, and run the feat_os_unix tests.

* wsl2: implemented review findings

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2025-08-03 14:38:49 +02:00
Dorian Peron 6e23d4e979 tests: patch tests to simplify imports 2025-07-01 03:36:46 +02:00
Sylvestre Ledru a0179ea239 uutests: adjust the tests to use them 2025-03-28 21:40:31 +01:00
Sylvestre Ledru a85539f530 Run cargo fmt on the tree 2025-03-24 21:33:12 +01:00
Daniel Hofstetter df4dfea852 tests: replace run() with succeeds() or fails() 2025-03-09 16:53:56 +01:00
Sylvestre Ledru 18cb7dcf9e Use the new function fails_with_code
Done with
```
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.no_stdout\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2)\n\1.no_stdout();/gs' *rs
$ sed -i -e "s|.fails()(.*).code_is(|.fails_with_code(|g" *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2);/gs' *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)(.*?)[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\3)\2;/gs' *rs
...
```
2025-03-01 17:26:20 +01:00
Justin Tracey ff8a31e835 wc: fix escaping
GNU wc only escapes file names with newlines in them.
2024-12-27 11:37:16 -05:00
n4n5 ab67947321 fix clippy tests 2024-06-30 16:27:08 +02:00
Sylvestre Ledru 09e53f3d2d tests: fix some clippy warnings 2024-05-25 09:06:16 +02:00
Ben Wiederhake 91679fc747 wc: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:47 +02:00
Ben Wiederhake d5e7f9a4a4 wc: count ASCII control characters as word characters 2024-04-07 02:12:22 +02:00
Daniel Hofstetter df492d34cb wc: disable part of test on Android 2023-12-24 13:20:57 +01:00
Yykz 652e02fb59 cargo fmt 2023-12-18 15:34:51 +01:00
Yykz cae113c237 Added tests 2023-12-18 14:12:59 +01:00
zhitkoffandYury Zhytkou 967c539cc6 wc: more tests 2023-12-07 10:50:55 -05:00
zhitkoffandYury Zhytkou 054ca4a6b5 wc: better handle files in pseudo-filesystems 2023-12-07 10:50:55 -05:00