Open GoogleCodeExporter opened 9 years ago
Here's my replacement for line 267 of shUnit 2.1.5 to fix this:
_shunit_escaped_test="${1//\\/\\\\}"
_shunit_escaped_test="${_shunit_escaped_test//\$/\\\$}"
_shunit_escaped_test="${_shunit_escaped_test//\`/\\\`}"
_shunit_escaped_test="${_shunit_escaped_test//\"/\\\"}"
assertTrue "${shunit_message_}" "[ -n \"${_shunit_escaped_test}\" ]"
And here are some additional test cases for
src/shell/shunit2_test_asserts.sh:testAssertNotNull():
( assertNotNull "x'b" >"${stdoutF}" 2>"${stderrF}" )
th_assertTrueWithNoOutput 'not null, with single-quote' $? "${stdoutF}" "${stderrF}"
( assertNotNull 'x"b' >"${stdoutF}" 2>"${stderrF}" )
th_assertTrueWithNoOutput 'not null, with double-quote' $? "${stdoutF}" "${stderrF}"
( assertNotNull 'x$b' >"${stdoutF}" 2>"${stderrF}" )
th_assertTrueWithNoOutput 'not null, with dollar' $? "${stdoutF}" "${stderrF}"
( assertNotNull 'x`b' >"${stdoutF}" 2>"${stderrF}" )
th_assertTrueWithNoOutput 'not null, with backtick' $? "${stdoutF}" "${stderrF}"
Original comment by wood4...@gmail.com
on 19 Mar 2010 at 2:45
Looking at including a fix for this in 2.1.6. The code by wood4321 is a good
start, but only works in some shells.
I'll try to adapt it and make it portable.
Original comment by kate.war...@gtempaccount.com
on 11 May 2010 at 8:36
I've added some improvements for strange chars (like single quotes), but so far
they only work under OS X due to sed variations. (See CL# 312)
Original comment by kate.war...@gtempaccount.com
on 14 Mar 2011 at 10:47
Original issue reported on code.google.com by
GVa...@gmail.com
on 18 May 2009 at 1:45Attachments: