dash reports a negative $LINENO when using shunit2's macros - this isn't shunit2's fault, so allow for it in the test cases --- shunit2-2.1.8/shunit2_macros_test.sh +++ shunit2-2.1.8/shunit2_macros_test.sh @@ -27,13 +27,13 @@ testAssertEquals() { [ -z "${LINENO:-}" ] && startSkipping ( ${_ASSERT_EQUALS_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_EQUALS_ failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_ASSERT_EQUALS_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_EQUALS_ w/ msg failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 @@ -46,13 +46,13 @@ testAssertNotEquals() { [ -z "${LINENO:-}" ] && startSkipping ( ${_ASSERT_NOT_EQUALS_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NOT_EQUALS_ failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_ASSERT_NOT_EQUALS_} '"some msg"' 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NOT_EQUALS_ w/ msg failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 @@ -65,13 +65,13 @@ testSame() { [ -z "${LINENO:-}" ] && startSkipping ( ${_ASSERT_SAME_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_SAME_ failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_ASSERT_SAME_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_SAME_ w/ msg failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 @@ -84,13 +84,13 @@ testNotSame() { [ -z "${LINENO:-}" ] && startSkipping ( ${_ASSERT_NOT_SAME_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NOT_SAME_ failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_ASSERT_NOT_SAME_} '"some msg"' 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NOT_SAME_ w/ msg failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 @@ -103,13 +103,13 @@ testNull() { [ -z "${LINENO:-}" ] && startSkipping ( ${_ASSERT_NULL_} 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NULL_ failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_ASSERT_NULL_} '"some msg"' 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NULL_ w/ msg failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 @@ -123,13 +123,13 @@ testNotNull() [ -z "${LINENO:-}" ] && startSkipping ( ${_ASSERT_NOT_NULL_} '' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NOT_NULL_ failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_ASSERT_NOT_NULL_} '"some msg"' '""' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_NOT_NULL_ w/ msg failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stdoutF}" "${stderrF}" >&2 @@ -142,13 +142,13 @@ testAssertTrue() { [ -z "${LINENO:-}" ] && startSkipping ( ${_ASSERT_TRUE_} "${SHUNIT_FALSE}" >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_TRUE_ failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_ASSERT_TRUE_} '"some msg"' "${SHUNIT_FALSE}" >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_TRUE_ w/ msg failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 @@ -161,13 +161,13 @@ testAssertFalse() { [ -z "${LINENO:-}" ] && startSkipping ( ${_ASSERT_FALSE_} "${SHUNIT_TRUE}" >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_FALSE_ failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_ASSERT_FALSE_} '"some msg"' "${SHUNIT_TRUE}" >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_ASSERT_FALSE_ w/ msg failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 @@ -180,13 +180,13 @@ testFail() { [ -z "${LINENO:-}" ] && startSkipping ( ${_FAIL_} >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_ failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_FAIL_} '"some msg"' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_ w/ msg failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 @@ -200,13 +200,13 @@ testFailNotEquals() [ -z "${LINENO:-}" ] && startSkipping ( ${_FAIL_NOT_EQUALS_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_NOT_EQUALS_ failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_FAIL_NOT_EQUALS_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_NOT_EQUALS_ w/ msg failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 @@ -219,13 +219,13 @@ testFailSame() { [ -z "${LINENO:-}" ] && startSkipping ( ${_FAIL_SAME_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_SAME_ failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_FAIL_SAME_} '"some msg"' 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_SAME_ w/ msg failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 @@ -238,13 +238,13 @@ testFailNotSame() { [ -z "${LINENO:-}" ] && startSkipping ( ${_FAIL_NOT_SAME_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_NOT_SAME_ failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2 ( ${_FAIL_NOT_SAME_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null + grep '^ASSERT:\[[0-9-]*\] *' "${stdoutF}" >/dev/null rtrn=$? assertTrue '_FAIL_NOT_SAME_ w/ msg failure' ${rtrn} [ "${rtrn}" -ne "${SHUNIT_TRUE}" ] && cat "${stderrF}" >&2