summaryrefslogtreecommitdiffstats
path: root/tests/ob_plat_is_concerned.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ob_plat_is_concerned.sh')
-rwxr-xr-x[-rw-r--r--]tests/ob_plat_is_concerned.sh121
1 files changed, 87 insertions, 34 deletions
diff --git a/tests/ob_plat_is_concerned.sh b/tests/ob_plat_is_concerned.sh
index bbde8d6..df8310b 100644..100755
--- a/tests/ob_plat_is_concerned.sh
+++ b/tests/ob_plat_is_concerned.sh
@@ -17,37 +17,90 @@
# 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
-
-ret=0
-host_plat=
-plats=
-result=
-
-main()
-{
- . ./ob_plat_is_concerned.rc
-
- exit ${ret}
-}
-
-testcase()
-{
- if ob_plat_is_concerned "${host_plat}" "${plats}"; then
- if ! ${result}; then
- printf 'False positive:\n' >&2
- printf ' Host platform: "%s"\n' "${host_plat}" >&2
- printf ' Package platforms: "%s"\n' "${plats}" >&2
- ret=1
- fi
- else
- if ${result}; then
- printf 'False negative:\n' >&2
- printf ' Host platform: "%s"\n' "${host_plat}" >&2
- printf ' Package platforms: "%s"\n' "${plats}" >&2
- ret=1
- fi
- fi
-}
-
-main "${@}"
+srcdir="$(dirname "${0}")"
+top_builddir="${PWD}"
+
+. "${srcdir}/aux/tap-functions.sh"
+. "${top_builddir}/lib/libopkbuild.shso.1"
+
+plan_ 12
+
+# Platform: all
+
+command_ok_ \
+ 'HOST "dev" DOES NOT MATCH PLAT "all"' -- \
+ not ob_plat_is_concerned \
+ 'dev' \
+ 'all'
+
+command_ok_ \
+ 'HOST "ao751h" DOES NOT MATCH PLAT "all"' -- \
+ not ob_plat_is_concerned \
+ 'ao751h' \
+ 'all'
+
+command_ok_ \
+ 'HOST "all" DOES MATCH PLAT "all"' -- \
+ ob_plat_is_concerned \
+ 'all' \
+ 'all'
+
+# Platform: any
+
+command_ok_ \
+ 'HOST "dev" DOES MATCH PLAT "any"' -- \
+ ob_plat_is_concerned \
+ 'dev' \
+ 'any'
+
+command_ok_ \
+ 'HOST "ao751h" DOES MATCH PLAT "any"' -- \
+ ob_plat_is_concerned \
+ 'ao751h' \
+ 'any'
+
+command_ok_ \
+ 'HOST "all" DOES NOT MATCH PLAT "any"' -- \
+ not ob_plat_is_concerned \
+ 'all' \
+ 'any'
+
+# Platform: dev
+
+command_ok_ \
+ 'HOST "dev" DOES MATCH PLAT "dev"' -- \
+ ob_plat_is_concerned \
+ 'dev' \
+ 'dev'
+
+command_ok_ \
+ 'HOST "ao751h" DOES NOT MATCH PLAT "dev"' -- \
+ not ob_plat_is_concerned \
+ 'ao751h' \
+ 'dev'
+
+command_ok_ \
+ 'HOST "all" DOES NOT MATCH PLAT "dev"' -- \
+ not ob_plat_is_concerned \
+ 'all' \
+ 'dev'
+
+# Platform: !dev
+
+command_ok_ \
+ 'HOST "dev" DOES NOT MATCH PLAT "!dev"' -- \
+ not ob_plat_is_concerned \
+ 'dev' \
+ '!dev'
+
+command_ok_ \
+ 'HOST "ao751h" DOES MATCH PLAT "!dev"' -- \
+ ob_plat_is_concerned \
+ 'ao751h' \
+ '!dev'
+
+command_ok_ \
+ 'HOST "all" DOES NOT MATCH PLAT "!dev"' -- \
+ not ob_plat_is_concerned \
+ 'all' \
+ '!dev'