summaryrefslogtreecommitdiff
path: root/user/shunit2
diff options
context:
space:
mode:
Diffstat (limited to 'user/shunit2')
-rw-r--r--user/shunit2/APKBUILD33
-rw-r--r--user/shunit2/dash-negative-lineno.patch197
2 files changed, 230 insertions, 0 deletions
diff --git a/user/shunit2/APKBUILD b/user/shunit2/APKBUILD
new file mode 100644
index 000000000..8a110ff6d
--- /dev/null
+++ b/user/shunit2/APKBUILD
@@ -0,0 +1,33 @@
+# Contributor: Max Rees <maxcrees@me.com>
+# Maintainer: Max Rees <maxcrees@me.com>
+pkgname=shunit2
+pkgver=2.1.7
+pkgrel=0
+pkgdesc="xUnit-based unit test framework for Bourne shell scripts"
+url="https://github.com/kward/shunit2"
+arch="noarch"
+license="Apache-2.0"
+depends="/bin/sh"
+makedepends=""
+checkdepends="debianutils-which bash dash zsh"
+subpackages="$pkgname-doc"
+source="$pkgname-$pkgver.tar.gz::https://github.com/kward/shunit2/archive/v$pkgver.tar.gz
+ dash-negative-lineno.patch"
+
+build() {
+ cd "$builddir"
+}
+
+check() {
+ cd "$builddir"
+ ./test_runner
+}
+
+package() {
+ cd "$builddir"
+ install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
+ install -Dm644 "doc/$pkgname.txt" "$pkgdir/usr/share/doc/$pkgname/$pkgname.rst"
+}
+
+sha512sums="35453cf2c469eb1bab2fff0624b8037a09d405c377fec0938875a6339749d5934fe246eec5691a121290ae9e4ee5cbf7768b740c5f0010a5345c4e111c50fbbd shunit2-2.1.7.tar.gz
+af2d3c65e9f3c86796b12832c403a869767b70da819f3cf6f69f0e2cf8445e85ec63db20c4b39430e35b7c2105e439abf6bbbd3fc3d880d23ee11d54339c61fd dash-negative-lineno.patch"
diff --git a/user/shunit2/dash-negative-lineno.patch b/user/shunit2/dash-negative-lineno.patch
new file mode 100644
index 000000000..2508be856
--- /dev/null
+++ b/user/shunit2/dash-negative-lineno.patch
@@ -0,0 +1,197 @@
+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.7/shunit2_macros_test.sh
++++ shunit2-2.1.7/shunit2_macros_test.sh
+@@ -27,13 +27,13 @@
+ [ -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
+@@ -44,13 +44,13 @@
+ [ -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
+@@ -61,13 +61,13 @@
+ [ -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
+@@ -78,13 +78,13 @@
+ [ -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
+@@ -95,13 +95,13 @@
+ [ -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
+@@ -113,13 +113,13 @@
+ [ -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
+@@ -130,13 +130,13 @@
+ [ -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
+@@ -147,13 +147,13 @@
+ [ -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
+@@ -164,13 +164,13 @@
+ [ -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
+@@ -182,13 +182,13 @@
+ [ -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
+@@ -199,13 +199,13 @@
+ [ -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
+@@ -216,13 +216,13 @@
+ [ -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