Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature parity with GNU head #1581

Closed
chadbrewbaker opened this issue Aug 4, 2020 · 3 comments
Closed

Feature parity with GNU head #1581

chadbrewbaker opened this issue Aug 4, 2020 · 3 comments

Comments

@chadbrewbaker
Copy link
Contributor

chadbrewbaker commented Aug 4, 2020

See this line and below. I ran the GNU head test suite against a uu_head binary and added failing unit test cases:

fn test_spams_newline() {

echo -e "a" | uu_head # returns "a\n" not "a"
echo -e "abc" | uu_head -1c # barfs instead of returning "a"
echo -e "a\n" | uu_head -n 2048m # barfs instead of returning "a\n"
echo -e "x\0y" | uu_head  -z -n 1 # barfs instead of returning "x\0"
echo -e "x\0y" | uu_head  -z -n 2 # barfs instead of returning "x\0y"
echo -e "a\n" | uu_head  --bytes=-2 # barfs instead of returning ""
echo -e "a\nb\n" | uu_head  --lines=-0  # "" returns instead of "a\nb\n"
@FelipeLema
Copy link
Contributor

It seems that these tests are already passing? Check my build with the [#ignore]s removed

@SuperSandro2000
Copy link
Contributor

Related #1822

@jfinkels
Copy link
Collaborator

I just tested these examples. Taking into account the fact that echo appends a newline character, these are all working as expected. They match the output of GNU head, so I think this can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants