unexpand: should allow multiple files #5852 and unexpand: show error message if a directory is specified #5845#5864
unexpand: should allow multiple files #5852 and unexpand: show error message if a directory is specified #5845#5864cakebaker merged 4 commits intouutils:mainfrom biplab5464:test
Conversation
…message if a directory is specified #5845
|
GNU testsuite comparison: |
|
do i have to write the test cases also for the above fix ? |
|
Yes, please :) |
how to add content to the files |
|
You can use |
|
why this test is failing Style/spelling (ubuntu-latest, feat_os_unix) |
|
It fails because "contenta" isn't a valid English word. I think you are missing a |
the test is failing if \n is added the stdout is printing "contenta b" this only |
|
Yes, you also have to adapt your implementation ;-) Best to look at what GNU Here you can see, that GNU Hope this helps. |
here the output is same to GNU i mean in the above it is printing on new line in the test cases i don't why it is not adding \n for a new line |
|
You are right, the implementation works fine :) I don't know yet why there is no |
|
what should be next step this test case will not fail after that |
|
Ok, I figured out I was wrong and your test is correct. Sorry about that. To make the Style/Spelling test pass, you can add below the license info in |
tests/by-util/test_unexpand.rs
Outdated
| let (at, mut ucmd) = at_and_ucmd!(); | ||
|
|
||
| ucmd.arg("asdf.txt") |
There was a problem hiding this comment.
The at causes an "unused variable"-warning. Instead of at_and_ucmd!() you can simply use new_cmd!() in this case:
| let (at, mut ucmd) = at_and_ucmd!(); | |
| ucmd.arg("asdf.txt") | |
| new_cmd!() | |
| .arg("asdf.txt") |
src/uu/unexpand/src/unexpand.rs
Outdated
| if filename.is_dir() { | ||
| Err(Box::new(USimpleError { | ||
| code: 1, | ||
| message: format!("unexpand: {}: Is a directory", filename.display()), |
There was a problem hiding this comment.
USimpleError automatically adds the utils name so you don't have to add it manually:
| message: format!("unexpand: {}: Is a directory", filename.display()), | |
| message: format!("{}: Is a directory", filename.display()), |
|
Thanks you for the suggestion |
|
is my PR ready for merge ? |
|
And merged, thanks for your PR :) |
|
Thank you for your cooperation |
|
Great to hear, you are welcome :) |
fix in this PR