diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-21 17:35:06 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-21 17:35:06 (EDT) |
commit | ffdfa2f2b77faa8e6e0f6c77238bec37b2296116 (patch) | |
tree | 6a876fed07d731ed616315b27da69ef370ae1910 /tests | |
parent | 84ec2e6ca5dd08be47a05989755b9820df49420e (diff) |
tests/plat_is_concerned.sh: Convert to TAP
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/plat_is_concerned.sh | 135 |
1 files changed, 94 insertions, 41 deletions
diff --git a/tests/plat_is_concerned.sh b/tests/plat_is_concerned.sh index 120aa5a..4e00a50 100755 --- a/tests/plat_is_concerned.sh +++ b/tests/plat_is_concerned.sh @@ -1,6 +1,6 @@ # plat_is_concerned() tests # -# Copyright (C) 2014 Patrick "P. J." McDermott +# Copyright (C) 2014, 2018, 2019 Patrick McDermott # # This file is part of the ProteanOS Development Kit. # @@ -18,60 +18,113 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -do_test() +main() { - local host_plat="${1}" - local plats="${2}" - local result="${3}" + . "${srcdir}/tests/aux/tap-functions.sh" - if plat_is_concerned "${host_plat}" "${plats}"; then - if ! ${result}; then - printf 'False positive:\n' - printf ' Host platform: "%s"\n' "${host_plat}" - printf ' Package platforms: "%s"\n' "${plats}" - tests_es=1 - fi - else - if ${result}; then - printf 'False negative:\n' - printf ' Host platform: "%s"\n' "${host_plat}" - printf ' Package platforms: "%s"\n' "${plats}" - tests_es=1 - fi - fi -} + plan_ 18 -main() -{ # Platform: all - do_test dev 'all' false - do_test ao751h 'all' false - do_test all 'all' true + command_ok_ \ + 'HOST "dev" DOES NOT MATCH PLAT "all"' -- \ + not plat_is_concerned \ + 'dev' \ + 'all' + command_ok_ \ + 'HOST "ao751h" DOES NOT MATCH PLAT "all"' -- \ + not plat_is_concerned \ + 'ao751h' \ + 'all' + command_ok_ \ + 'HOST "all" DOES MATCH PLAT "all"' -- \ + plat_is_concerned \ + 'all' \ + 'all' # Platform: any - do_test dev 'any' true - do_test ao751h 'any' true - do_test all 'any' false + command_ok_ \ + 'HOST "dev" DOES MATCH PLAT "any"' -- \ + plat_is_concerned \ + 'dev' \ + 'any' + command_ok_ \ + 'HOST "ao751h" DOES MATCH PLAT "any"' -- \ + plat_is_concerned \ + 'ao751h' \ + 'any' + command_ok_ \ + 'HOST "all" DOES NOT MATCH PLAT "any"' -- \ + not plat_is_concerned \ + 'all' \ + 'any' # Platform: dev - do_test dev 'dev' true - do_test ao751h 'dev' false - do_test all 'dev' false + command_ok_ \ + 'HOST "dev" DOES MATCH PLAT "dev"' -- \ + plat_is_concerned \ + 'dev' \ + 'dev' + command_ok_ \ + 'HOST "ao751h" DOES NOT MATCH PLAT "dev"' -- \ + not plat_is_concerned \ + 'ao751h' \ + 'dev' + command_ok_ \ + 'HOST "all" DOES NOT MATCH PLAT "dev"' -- \ + not plat_is_concerned \ + 'all' \ + 'dev' # Platform: !dev - do_test dev '!dev' false - do_test ao751h '!dev' true - do_test all '!dev' false + command_ok_ \ + 'HOST "dev" DOES NOT MATCH PLAT "!dev"' -- \ + not plat_is_concerned \ + 'dev' \ + '!dev' + command_ok_ \ + 'HOST "ao751h" DOES MATCH PLAT "!dev"' -- \ + plat_is_concerned \ + 'ao751h' \ + '!dev' + command_ok_ \ + 'HOST "all" DOES NOT MATCH PLAT "!dev"' -- \ + not plat_is_concerned \ + 'all' \ + '!dev' # Platform: dev dimension2400 - do_test 'dev' 'dev dimension2400' true - do_test 'ao751h' 'dev dimension2400' false - do_test 'all' 'dev dimension2400' false + command_ok_ \ + 'HOST "dev" DOES MATCH PLAT "dev dimension2400"' -- \ + plat_is_concerned \ + 'dev' \ + 'dev dimension2400' + command_ok_ \ + 'HOST "ao751h" DOES NOT MATCH PLAT "dev dimension2400"' -- \ + not plat_is_concerned \ + 'ao751h' \ + 'dev dimension2400' + command_ok_ \ + 'HOST "all" DOES NOT MATCH PLAT "dev dimension2400"' -- \ + not plat_is_concerned \ + 'all' \ + 'dev dimension2400' # Platform: dev all - do_test 'dev' 'dev all' true - do_test 'ao751h' 'dev all' false - do_test 'all' 'dev all' true + command_ok_ \ + 'HOST "dev" DOES MATCH PLAT "dev all"' -- \ + plat_is_concerned \ + 'dev' \ + 'dev all' + command_ok_ \ + 'HOST "ao751h" DOES NOT MATCH PLAT "dev all"' -- \ + not plat_is_concerned \ + 'ao751h' \ + 'dev all' + command_ok_ \ + 'HOST "all" DOES MATCH PLAT "dev all"' -- \ + plat_is_concerned \ + 'all' \ + 'dev all' return 0 } |