Skip to content

Improve output when string not equal for long strings #104

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 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
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
11 changes: 9 additions & 2 deletions shunit2
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,16 @@ 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
shunit_diff_=$(diff <(echo "${shunit_expected_}") <(echo "${shunit_actual_}"))
_shunit_assertFail "${shunit_message_:+${shunit_message_} }diff:<${shunit_diff_}>"
else
_shunit_assertFail "${shunit_message_:+${shunit_message_} }expected:<${shunit_expected_}> but was:<${shunit_actual_}>"
fi

unset shunit_message_ shunit_expected_ shunit_actual_
unset shunit_message_ shunit_expected_ shunit_actual_ shunit_diff_
return ${SHUNIT_FALSE}
}
# shellcheck disable=SC2016,SC2034
Expand Down