diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-22 01:48:57 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-22 01:48:57 (EDT) |
commit | d841dc0bfb1d18a2f85f76096d4aebc4d772b88e (patch) | |
tree | d3c59eed4e2af1a88b7a6cc7c06f1eee6c4e6110 /tests/plat_is_concerned.sh | |
parent | 44e452fb3c8cc7a093d72fbc280be3973e627a62 (diff) | |
parent | 76885ce7f12b98f0700a3a0535e06425bc1a9aa5 (diff) |
Merge branch 'feature/tap-tests'
Diffstat (limited to 'tests/plat_is_concerned.sh')
-rwxr-xr-x | tests/plat_is_concerned.sh | 135 |
1 files changed, 93 insertions, 42 deletions
diff --git a/tests/plat_is_concerned.sh b/tests/plat_is_concerned.sh index 120aa5a..0905a22 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,111 @@ # along with the ProteanOS Development Kit. If not, see # <http://www.gnu.org/licenses/>. -do_test() -{ - local host_plat="${1}" - local plats="${2}" - local result="${3}" - - 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 -} - main() { + plan_ 18 + # 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 } |