-
Notifications
You must be signed in to change notification settings - Fork 209
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
Improve output when string not equal for long strings #104
base: master
Are you sure you want to change the base?
Conversation
shunit2
Outdated
_shunit_assertFail "${shunit_message_:+${shunit_message_} }diff:<${diff_output_}>" | ||
else | ||
_shunit_assertFail "${shunit_message_:+${shunit_message_} }expected:<${shunit_expected_}> but was:<${shunit_actual_}>" | ||
fi | ||
|
||
unset shunit_message_ shunit_expected_ shunit_actual_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add your new variable here.
shunit2
Outdated
@@ -630,7 +630,12 @@ failNotEquals() { | |||
shunit_actual_=$2 | |||
|
|||
shunit_message_=${shunit_message_%% } | |||
_shunit_assertFail "${shunit_message_:+${shunit_message_} }expected:<${shunit_expected_}> but was:<${shunit_actual_}>" | |||
if command [ $(echo "${shunit_expected_}" | wc -l) -gt 10 ] || command [ $(echo "${shunit_actual_}" | wc -l) -gt 10 ]; then | |||
diff_output_=$(diff <(echo "${shunit_expected_}") <(echo "${shunit_actual_}")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recognize process substitution <()
as a Bashism, though I don't know the details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is process substitution, it provides a way of passing the output of a command to another command where pipe is not available. diff takes filenames, but the items that want to be diff'd are in variables.
I suspect this might be why the tests are failing, as it probably doesn't work in other shells.
If anyone has any suggestions on how I can do this differently then let me know.
No description provided.