From 44025437f45b1def2c0c65366b61691469f00dff Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 02 Oct 2012 03:20:22 -0400 Subject: Improve format of "ob_parse_dep" test data. --- diff --git a/tests/ob_parse_dep.data b/tests/ob_parse_dep.data deleted file mode 100644 index 5d19a4b..0000000 --- a/tests/ob_parse_dep.data +++ /dev/null @@ -1,16 +0,0 @@ -# dependency ; pkg ; archqual ; rel ; ver ; arches - -foo ;foo -foo:core-linux-eglibc ;foo;core-linux-eglibc -foo (>= 1.0) ;foo;;>=;1.0 -foo(>=1.0) ;foo;;>=;1.0 -foo (>= 1.0) ;foo;;>=;1.0 -foo [core-linux-eglibc] ;foo;;;;core-linux-eglibc -foo[core-linux-eglibc] ;foo;;;;core-linux-eglibc -foo [core-linux-eglibc] ;foo;;;;core-linux-eglibc -foo:core-linux-eglibc (>= 1.0) [core-linux-eglibc] \ - ;foo;core-linux-eglibc;>=;1.0;core-linux-eglibc -foo:core-linux-eglibc(>=1.0)[core-linux-eglibc] \ - ;foo;core-linux-eglibc;>=;1.0;core-linux-eglibc -foo:core-linux-eglibc (>= 1.0) [core-linux-eglibc] \ - ;foo;core-linux-eglibc;>=;1.0;core-linux-eglibc diff --git a/tests/ob_parse_dep.rc b/tests/ob_parse_dep.rc new file mode 100644 index 0000000..fd0a8ed --- /dev/null +++ b/tests/ob_parse_dep.rc @@ -0,0 +1,87 @@ +dep='foo' +pkg='foo' +archqual='' +rel='' +ver='' +arches='' +testcase + +dep='foo:core-linux-eglibc' +pkg='foo' +archqual='core-linux-eglibc' +rel='' +ver='' +arches='' +testcase + +dep='foo (>= 1.0)' +pkg='foo' +archqual='' +rel='>=' +ver='1.0' +arches='' +testcase + +dep='foo(>=1.0)' +pkg='foo' +archqual='' +rel='>=' +ver='1.0' +arches='' +testcase + +dep='foo (>= 1.0)' +pkg='foo' +archqual='' +rel='>=' +ver='1.0' +arches='' +testcase + +dep='foo [core-linux-eglibc]' +pkg='foo' +archqual='' +rel='' +ver='' +arches='core-linux-eglibc' +testcase + +dep='foo[core-linux-eglibc]' +pkg='foo' +archqual='' +rel='' +ver='' +arches='core-linux-eglibc' +testcase + +dep='foo [core-linux-eglibc]' +pkg='foo' +archqual='' +rel='' +ver='' +arches='core-linux-eglibc' +testcase + +dep='foo:core-linux-eglibc (>= 1.0) [core-linux-eglibc]' +pkg='foo' +archqual='core-linux-eglibc' +rel='>=' +ver='1.0' +arches='core-linux-eglibc' +testcase + +dep='foo:core-linux-eglibc(>=1.0)[core-linux-eglibc]' +pkg='foo' +archqual='core-linux-eglibc' +rel='>=' +ver='1.0' +arches='core-linux-eglibc' +testcase + +dep='foo:core-linux-eglibc (>= 1.0) [core-linux-eglibc]' +pkg='foo' +archqual='core-linux-eglibc' +rel='>=' +ver='1.0' +arches='core-linux-eglibc' +testcase diff --git a/tests/ob_parse_dep.sh b/tests/ob_parse_dep.sh index ccc8c4d..7a113a9 100644 --- a/tests/ob_parse_dep.sh +++ b/tests/ob_parse_dep.sh @@ -22,33 +22,34 @@ ob_use deps ret=0 - -while read line; do - - line="${line%%#*}" - [ -z "${line}" ] && continue - - IFS=';' read -r test_dep good_pkg good_archqual good_rel good_ver good_arches \ - </dev/null + -A test_arches "${dep}" >/dev/null for comp in pkg archqual rel ver arches; do - comp="$(echo "${comp}" | sed 's/^ *//;s/ *$//')" test_comp="$(eval echo \"\$\{test_${comp}\}\")" - good_comp="$(eval echo \"\$\{good_${comp}\}\")" + good_comp="$(eval echo \"\$\{${comp}\}\")" if [ "${test_comp}" != "${good_comp}" ]; then printf 'Dependency "%s", component "%s":\n "%s" != "%s"\n' \ - "${test_dep}" "${comp}" "${test_comp}" "${good_comp}" >&2 + "${dep}" "${comp}" "${test_comp}" "${good_comp}" >&2 ret=1 fi done +} -done <'ob_parse_dep.data' - -exit ${ret} +main "${@}" -- cgit v0.9.1