summaryrefslogtreecommitdiffstats
path: root/tests/ob_match_arch.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ob_match_arch.sh')
-rwxr-xr-x[-rw-r--r--]tests/ob_match_arch.sh108
1 files changed, 45 insertions, 63 deletions
diff --git a/tests/ob_match_arch.sh b/tests/ob_match_arch.sh
index 545b2af..589a912 100644..100755
--- a/tests/ob_match_arch.sh
+++ b/tests/ob_match_arch.sh
@@ -17,78 +17,60 @@
# 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
-arch=
-arch_field=
-result=
+. "${srcdir}/aux/tap-functions.sh"
+. "${top_builddir}/lib/libopkbuild.shso.1"
-main()
-{
- while read line; do
+plan_ 10
- line=${line%#*}
- line=$(echo ${line})
- [ -z "${line}" ] && continue
+command_ok_ 'all IN [all]' -- \
+ ob_match_arch \
+ 'all' \
+ 'all'
- eval set -- ${line}
+command_ok_ 'foo-bar-baz IN [any]' -- \
+ ob_match_arch \
+ 'foo-bar-baz' \
+ 'any'
- cmd="${1}"
- shift
- if echo ' set test ' | grep " ${cmd} " >/dev/null 2>&1; then
- "cmd_${cmd}" "${@}"
- else
- ob_error 'Invalid command in ob_match_arch.rc!'
- fi
+command_ok_ 'foo-bar-baz IN [any all]' -- \
+ ob_match_arch \
+ 'foo-bar-baz' \
+ 'any all'
- done <'ob_match_arch.rc'
+command_ok_ 'all IN [any all]' -- \
+ ob_match_arch \
+ 'all' \
+ 'any all'
- exit ${ret}
-}
+command_ok_ 'foo-bar-baz IN [foo-bar-any]' -- \
+ ob_match_arch \
+ 'foo-bar-baz' \
+ 'foo-bar-any'
-cmd_set()
-{
- if [ ${#} -lt 2 ]; then
- ob_error 'Invalid arguments to command "set" in ob_match_arch.rc!'
- fi
+command_ok_ 'foo-bar-baz NOT IN [foo-bar-qux]' -- \
+ not ob_match_arch \
+ 'foo-bar-baz' \
+ 'foo-bar-qux'
- name="${1}"
- shift
- value="${@}"
+command_ok_ 'foo-bar-baz IN [any-qux-any any-bar-any]' -- \
+ ob_match_arch \
+ 'foo-bar-baz' \
+ 'any-qux-any any-bar-any'
- case "${name}" in
- arch)
- arch="${value}"
- ;;
- arch_field)
- arch_field="${value}"
- ;;
- result)
- result="${value}"
- ;;
- *)
- ob_error \
- 'Invalid name argument to command "set" in ob_match_arch.rc!'
- ;;
- esac
-}
+command_ok_ 'foo-bar-baz NOT IN [any-qux-any any-quux-any]' -- \
+ not ob_match_arch \
+ 'foo-bar-baz' \
+ 'any-qux-any any-quux-any'
-cmd_test()
-{
- if ob_match_arch "${arch}" "${arch_field}"; then
- if [ "${result}" = 'false' ]; then
- printf 'False positive:\n arch: %s\n arch_field: %s\n' \
- "${arch}" "${arch_field}" >&2
- ret=1
- fi
- else
- if [ "${result}" = 'true' ]; then
- printf 'False negative:\n arch: %s\n arch_field: %s\n' \
- "${arch}" "${arch_field}" >&2
- ret=1
- fi
- fi
-}
+command_ok_ 'all NOT IN [any]' -- \
+ not ob_match_arch \
+ 'all' \
+ 'any'
-main "${@}"
+command_ok_ 'all NOT IN [foo-any-any]' -- \
+ not ob_match_arch \
+ 'all' \
+ 'foo-any-any'