# reduce_deps() tests # # Copyright (C) 2014, 2018, 2019 Patrick McDermott # # This file is part of the ProteanOS Development Kit. # # The ProteanOS Development Kit is free software: you can redistribute # it and/or modify it under the terms of the GNU General Public License # as published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # The ProteanOS Development Kit is distributed in the hope that it # will be useful, but WITHOUT ANY WARRANTY; without even the implied # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with the ProteanOS Development Kit. If not, see # . set -eu main() { plan_ 13 # Normal and union AND-lists. command_ok_ \ 'NORMAL LIST "foo, bar"' -- \ [ x"$(reduce_deps \ 'foo, bar' false \ 'amd64-linux-glibc' 'dev' \ )" = \ x'foo, bar' \ ] command_ok_ \ 'NORMAL LIST "foo,bar"' -- \ [ x"$(reduce_deps \ 'foo,bar' false \ 'amd64-linux-glibc' 'dev' \ )" = \ x'foo, bar' \ ] command_ok_ \ 'NORMAL LIST "foo, bar"' -- \ [ x"$(reduce_deps \ 'foo, bar' false \ 'amd64-linux-glibc' 'dev' \ )" = \ x'foo, bar' \ ] command_ok_ \ 'UNION LIST "foo, bar"' -- \ [ x"$(reduce_deps \ 'foo, bar' true \ 'amd64-linux-glibc' 'dev' \ )" = \ x'foo, bar' \ ] command_ok_ \ 'UNION LIST "foo,bar"' -- \ [ x"$(reduce_deps \ 'foo,bar' true \ 'amd64-linux-glibc' 'dev' \ )" = \ x'foo, bar' \ ] command_ok_ \ 'UNION LIST "foo, bar"' -- \ [ x"$(reduce_deps \ 'foo, bar' true \ 'amd64-linux-glibc' 'dev' \ )" = \ x'foo, bar' \ ] # Normal and union OR-lists. command_ok_ \ 'NORMAL LIST "foo | bar"' -- \ [ x"$(reduce_deps \ 'foo | bar' false \ 'amd64-linux-glibc' 'dev' \ )" = \ x'foo | bar' \ ] command_ok_ \ 'NORMAL LIST "foo|bar"' -- \ [ x"$(reduce_deps \ 'foo|bar' false \ 'amd64-linux-glibc' 'dev' \ )" = \ x'foo | bar' \ ] command_ok_ \ 'NORMAL LIST "foo | bar"' -- \ [ x"$(reduce_deps \ 'foo | bar' false \ 'amd64-linux-glibc' 'dev' \ )" = \ x'foo | bar' \ ] # Normal and union AND-lists with arch specs. command_ok_ \ 'NORMAL LIST "foo [amd64-linux-glibc], '$(: \ )'bar [!amd64-linux-glibc]"' -- \ [ x"$(reduce_deps \ 'foo [amd64-linux-glibc], bar [!amd64-linux-glibc]' \ false \ 'amd64-linux-glibc' 'dev' \ )" = \ x'foo' \ ] command_ok_ \ 'UNION LIST "foo [amd64-linux-glibc], '$(: \ )'bar [!amd64-linux-glibc]"' -- \ [ x"$(reduce_deps \ 'foo [amd64-linux-glibc], bar [!amd64-linux-glibc]' \ true \ 'amd64-linux-glibc' 'dev' \ )" = \ x'foo' \ ] # Normal and union AND-lists with plat specs. command_ok_ \ 'NORMAL LIST "foo , bar "' -- \ [ x"$(reduce_deps \ 'foo , bar ' false \ 'amd64-linux-glibc' 'dev' \ )" = \ x'foo' \ ] command_ok_ \ 'UNION LIST "foo , bar "' -- \ [ x"$(reduce_deps \ 'foo , bar ' true \ 'amd64-linux-glibc' 'dev' \ )" = \ x'foo' \ ] return 0 }