Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion shunit2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
daveshepherd marked this conversation as resolved.
Outdated
Comment thread
daveshepherd marked this conversation as resolved.
Outdated
diff_output_=$(diff <(echo "${shunit_expected_}") <(echo "${shunit_actual_}"))
Comment thread
daveshepherd marked this conversation as resolved.
Outdated
Copy link
Copy Markdown

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.

Copy link
Copy Markdown
Author

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.

_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_
Copy link
Copy Markdown
Owner

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.

return ${SHUNIT_FALSE}
Expand Down