summaryrefslogtreecommitdiffstats
path: root/tests/ob_parse_dep.sh
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2018-12-24 21:24:51 (EST)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2018-12-24 21:24:51 (EST)
commit7433c95471a427f679ebf38e91c24357fa8e2b51 (patch)
treefb788a46f4817576997700a7a0b8d85e8a9f17d3 /tests/ob_parse_dep.sh
parentdadca6c8ce9946fbfdd1a0feaa2e2a8a32feeb29 (diff)
tests/ob_parse_dep.sh: Convert to TAP
Diffstat (limited to 'tests/ob_parse_dep.sh')
-rwxr-xr-x[-rw-r--r--]tests/ob_parse_dep.sh137
1 files changed, 118 insertions, 19 deletions
diff --git a/tests/ob_parse_dep.sh b/tests/ob_parse_dep.sh
index 2b4a074..1278533 100644..100755
--- a/tests/ob_parse_dep.sh
+++ b/tests/ob_parse_dep.sh
@@ -17,37 +17,136 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. ./common.sh
+srcdir="$(dirname "${0}")"
+top_builddir="${PWD}"
-ret=0
-dep=
-pkg=
-archqual=
-rel=
-ver=
-arches=
-
-main()
-{
- . ./ob_parse_dep.rc
-
- exit ${ret}
-}
+. "${srcdir}/aux/tap-functions.sh"
+. "${top_builddir}/lib/libopkbuild.shso.1"
testcase()
{
+ local dep="${1}"
+ local pkg="${2}"
+ local archqual="${3}"
+ local rel="${4}"
+ local ver="${5}"
+ local arches="${6}"
+ shift 6
+ local result=
+
ob_parse_dep -p test_pkg -q test_archqual -r test_rel -v test_ver \
-A test_arches "${dep}" >/dev/null
+ result='ok_'
for comp in pkg archqual rel ver arches; do
test_comp="$(eval echo \"\$\{test_${comp}\}\")"
good_comp="$(eval echo \"\$\{${comp}\}\")"
if [ "${test_comp}" != "${good_comp}" ]; then
- printf 'Dependency "%s", component "%s":\n "%s" != "%s"\n' \
- "${dep}" "${comp}" "${test_comp}" "${good_comp}" >&2
- ret=1
+ diag_ "$(printf 'Dependency "%s", component "%s":' \
+ "${dep}" "${comp}")"
+ diag_ "$(printf ' "%s" != "%s"\n' \
+ "${test_comp}" "${good_comp}")"
+ result='not_ok_'
fi
done
+
+ "${result}" -- "PARSE DEPENDENCY \"${dep}\""
}
-main "${@}"
+plan_ 12
+
+testcase \
+ 'foo' \
+ 'foo' \
+ '' \
+ '' \
+ '' \
+ ''
+
+testcase \
+ 'foo:core-linux-eglibc' \
+ 'foo' \
+ 'core-linux-eglibc' \
+ '' \
+ '' \
+ ''
+
+testcase \
+ 'foo (>= 1.0)' \
+ 'foo' \
+ '' \
+ '>=' \
+ '1.0' \
+ ''
+
+testcase \
+ 'foo(>=1.0)' \
+ 'foo' \
+ '' \
+ '>=' \
+ '1.0' \
+ ''
+
+testcase \
+ 'foo (>= 1.0)' \
+ 'foo' \
+ '' \
+ '>=' \
+ '1.0' \
+ ''
+
+testcase \
+ 'foo [core-linux-eglibc]' \
+ 'foo' \
+ '' \
+ '' \
+ '' \
+ 'core-linux-eglibc'
+
+testcase \
+ 'foo[core-linux-eglibc]' \
+ 'foo' \
+ '' \
+ '' \
+ '' \
+ 'core-linux-eglibc'
+
+testcase \
+ 'foo [core-linux-eglibc]' \
+ 'foo' \
+ '' \
+ '' \
+ '' \
+ 'core-linux-eglibc'
+
+testcase \
+ 'foo:core-linux-eglibc (>= 1.0) [core-linux-eglibc]' \
+ 'foo' \
+ 'core-linux-eglibc' \
+ '>=' \
+ '1.0' \
+ 'core-linux-eglibc'
+
+testcase \
+ 'foo:core-linux-eglibc(>=1.0)[core-linux-eglibc]' \
+ 'foo' \
+ 'core-linux-eglibc' \
+ '>=' \
+ '1.0' \
+ 'core-linux-eglibc'
+
+testcase \
+ 'foo:core-linux-eglibc (>= 1.0) [core-linux-eglibc]' \
+ 'foo' \
+ 'core-linux-eglibc' \
+ '>=' \
+ '1.0' \
+ 'core-linux-eglibc'
+
+testcase \
+ 'busybox (<< 1.21.1.12)' \
+ 'busybox' \
+ '' \
+ '<<' \
+ '1.21.1.12' \
+ ''