Commit graph

46 commits

Author SHA1 Message Date
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
Jan Scheer
117e84eed3 tr: implement complement separately from delete or squeeze (#2147) 2021-05-01 18:46:13 +02:00
Jeffrey Finkelstein
0f3bc23739 tr: implement translate and squeeze (-s) mode
Add translate and squeeze mode to the `tr` program. For example:

    $ printf xx | tr -s x y
    y

Fixes #2141.
2021-04-30 18:17:05 -04:00
Jan Scheer
45dd9d4e96 tr/dirname: fix clap short_alias 2021-04-30 20:19:43 +02:00
Jan Scheer
646c6cacbc refactor tests (#1982) 2021-04-23 02:28:46 +02:00
Daniel Rocco
fbb9c50050 tr: process octal escape sequences
closes #1817
2021-03-17 08:04:45 -04:00
Roy Ivy III
02e4226c26 refactor/polish ~ cargo make format 2020-10-02 16:03:21 -05:00
Roy Ivy III
0fa249a944
Fix tr argument handling for missing arguments (#1601)
* tests/tr ~ confirm failure for missing argument(s)

* fix/tr ~ mimic GNU error reponse for missing argument(s)
2020-10-02 22:43:57 +02:00
Roy Ivy III
de0375f909 tests ~ reorganize tests 2020-06-01 18:30:04 -05:00
Renamed from tests/test_tr.rs (Browse further)