Commit graph

58 commits

Author SHA1 Message Date
Ben Wiederhake
e9045be593 tr: fix order inside class [:blank:] 2024-03-29 00:55:34 +01:00
Ben Wiederhake
76a2f2128b tr: guard against regressions of class [:space:] 2024-03-29 00:50:33 +01:00
Ben Wiederhake
44310f426c tr: enable passing -t multiple times 2024-02-24 18:37:45 +01:00
Ben Wiederhake
268af90843 tr: enable passing -s multiple times 2024-02-24 18:37:45 +01:00
Ben Wiederhake
dc664006fe tr: enable passing -d multiple times 2024-02-23 11:58:22 +01:00
Ben Wiederhake
cad94a69be tr: prevent passing options in the wrong place
Note: This requires using the DEPRECATED item Command::trailing_var_arg
in clap. This is going to be another
[problem with clap](https://github.com/tertsdiepraam/uutils-args/blob/main/docs/design/problems_with_clap.md).
2024-02-23 11:58:22 +01:00
Ben Wiederhake
d9b6675bbf tr: enable passing -c multiple times 2024-02-23 11:58:18 +01:00
Ben Wiederhake
617f3a8b6f tr: when deleting and squeezing, never complement set2 2024-02-23 06:08:37 +01:00
Ben Wiederhake
48c4b57c97 tr: require second string argument when deleting and squeezing 2024-02-23 03:23:07 +01:00
BaherSalama
5603305e75
fix tr with any flag with more than 2 operands (#5952)
* fix tr

* add tests

* fix clippy

* fix clippy2

* do suggestions

* do suggestions

* remove mut

* tr: move var to block & remove its type

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-02-13 15:30:15 +01:00
Daniel Hofstetter
9995c637aa tr: fix intermittent test caused by pipe_in() 2024-02-08 07:25:09 +01:00
BaherSalama
5c2ae5be4f
fix tr with delete flag if more than 1 operand given (#5945)
* fix tr

* fix

* adding a test

* tr: rename test function

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-02-06 16:42:08 +01:00
Terts Diepraam
bc5b5e013a tr: operate on bytes instead of chars 2023-12-11 13:35:17 +01:00
Sylvestre Ledru
bfca6bf70f Add license headers on all files 2023-08-21 10:49:27 +02:00
Daniel Hofstetter
6988eb7ec6 tests: expand wildcard imports 2023-03-20 15:32:35 +01:00
Yang Hau
ec81a23afc tr: Remove the extra newline in stderr
closes #4301
2023-02-15 02:04:43 +08: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
Terts Diepraam
9177cb7b24 all: add tests for usage error exit code 2022-09-10 20:59:42 +02:00
DevSabb
b8a3795d95
tr: fix octal interpretation of repeat count string (#3178)
* tr: fix octal interpretation of repeat count string

* tr: fix formatting errors

* tr: fix formatting issues 2

* tr: attempt to bypass spell check error

* tr: fix spell check errors attempt 2

* tr: formatting fixes

Co-authored-by: DevSabb <devsabb@local>
2022-02-25 12:11:53 +01:00
Terts Diepraam
9ddd61ab6b Merge branch 'main' into hbina-tr-reimplement-expansion 2022-01-21 14:42:30 +01:00
Terts Diepraam
9f649ffe9b tr: fix flaky test 2022-01-19 22:33:54 +01:00
Hanif Ariffin
c86cb91dee Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-11-26 16:39:27 +08:00
Roy Ivy III
f07a1749a1 fix spell-check errors 2021-11-19 17:55:02 -06:00
Hanif Bin Ariffin
1dc438c9d9 Fix spell check ignore list
Use this small script:

```shell
<list> | tr ' ' '\n' | sort | uniq | tr '\n' ' '
```

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-09-19 23:26:49 +08:00
Hanif Bin Ariffin
e0d1bf9bba Ignore some spell checks
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-09-19 23:15:42 +08:00
Hanif Bin Ariffin
9ab4f3de2f Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-09-19 23:01:48 +08:00
Sylvestre Ledru
1986d346dc Silent 'test_more_than_2_sets' on freebsd 2021-09-05 18:54:43 +02:00
Hanif Bin Ariffin
186886cd69 Ignore 1 test that is failing only in Windows
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
106ba4b77d Added one last missing test
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
d0b3a15994 Updated test ignore description
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
5bf0197da5 Added all GNU tests as rust tests
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
36c19293c8 Fixing tests
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
bf0f01714c Splitting out GNU tests
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
b7a0ad15a7 Cleaning up tests
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
d5dbedb2e4 Added more tests
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
55b2eacb4b Added gnu tests for tr (mostly as comments)
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
700ce7d64a Removed useless tests that were supposed to be filled with tests from GNU tr
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
db8f321abf Enabled the test for that weird backslash octal :)
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
c3bd727f8d Updated tests to be more descriptive and added its equivalent cmd line script
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
840c6e7b91 tr: Reimplementing set expansion
Hopefully will be feature parity with GNU `tr`.

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>

Implemented a bit of new expansion module

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>

Implemented delete operation

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>

Partially implemented delete operation

Will go through translate next.

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>

Fix formatting...

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>

Implemented translation feature

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:36:30 +08:00
Sylvestre Ledru
52c6593ef5
Merge pull request #2486 from hbina/hbina-tr-return-err-when-extra-args
`tr` should error out when if user provides more than 2 sets
2021-07-10 20:51:27 +02:00
Jan Scheer
30b80d0c82
tr: fix squeeze and complement with two sets (#2485) 2021-07-09 23:05:00 +02:00
Hanif Bin Ariffin
c4c6819dae Reimplemented simply using args
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-07-09 23:51:37 +08:00
Roy Ivy III
3f35e0a421 refactor ~ cargo make format 2021-05-31 08:23:58 -05:00
Roy Ivy III
4e20dedf58 tests ~ refactor/polish spelling (comments, names, and exceptions) 2021-05-31 08:23:57 -05:00
Jan Scheer
3fcac152f8
tr: add test 2021-05-02 18:35:52 +02:00
Jan Scheer
8739139a7f Merge branch 'master' into issue2147 2021-05-02 12:35:19 +02:00
Jan Scheer
34c22dc3ad tr: fix complement if set2 is range 2021-05-02 12:15:16 +02:00
Sylvestre Ledru
7e07438b38
Merge pull request #2151 from jfinkels/2141-translate-and-squeeze
tr: implement translate and squeeze (-s) mode
2021-05-01 23:27:43 +02:00
Jan Scheer
83eb704415 Merge branch 'master' into issue2147 2021-05-01 18:52:35 +02:00