Skip to content

Fixed race conditions #4

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fixed race conditions #4

wants to merge 3 commits into from

Conversation

riquito
Copy link

@riquito riquito commented Jun 10, 2013

assert.sh fail in a couple cases

  1. using assert, if your tested command has as parameter a string with a space separated asterisk then the asterisk will be evaluated by the shell.

  2. using assert, if your tested command has as parameter a string with characters that have a special meaning in printf, printf will output something unexpected

I suspect that in assert_raises
(eval $1 <<< ${3:-}) > /dev/null 2>&1
should really be written as
(eval "$1" <<< ${3:-}) > /dev/null 2>&1

but I can't produce a test case similar to 1)

p.s.
I couldn't figure out the meaning of "x required to overwrite older results": is it still needed once printf is gone?

@riquito
Copy link
Author

riquito commented Jun 10, 2013

It still fails with
assert "echo "a\nb"" "a\nb"

result is

test #10 "echo "a\nb"" failed:
expected "a\nb"
got "a\nb"

This happens with or without my pull request.

It's compairing the literal "a\nb" (4 letters) with "a
b" (3 letters) (the error message doesn't help here)

@riquito
Copy link
Author

riquito commented Jun 10, 2013

The latest commit ( df02b94 ) should solve the newline problem

@lehmannro
Copy link
Owner

I don't see commit df02b94 in this pull request or your repository. Could you recheck if you've pushed it?

@riquito
Copy link
Author

riquito commented Jun 12, 2013

It's two days that I wait for github to update the page (via git I see it pushed). Alas, it has finally appeared, you should be able to see it.

@mnothic
Copy link

mnothic commented Nov 13, 2013

hi I have a problem with this assert
bash test.sh
test #24 "get_color red" failed:
expected "\032[0;31m"
got "\033[0;31m"
1 of 25 tests failed in 0.171s.

@lehmannro
Copy link
Owner

It looks like indeed your expected output and the result are different —
one has \032, the other has \033.

For future problems, please also open a new ticket instead of amending an
existing, unrelated issue.

@mnothic
Copy link

mnothic commented Nov 13, 2013

Sorry, my fault, but with the same string still failing

test #24 "get_color red" failed:
expected "\033[0;31m"
got "\033[0;31m"
1 of 25 tests failed in 0.086s.

@joseluis joseluis mentioned this pull request Dec 30, 2016
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

Successfully merging this pull request may close these issues.

3 participants