summaryrefslogtreecommitdiffstats
path: root/tests/ob_reduce_deps.sh
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2018-12-24 18:44:25 (EST)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2018-12-24 18:44:25 (EST)
commitb143764aba756a28caf74fc4878e74ca66d2eeab (patch)
treee214c62f37811e0d92f6af18aeecdd3a9218f367 /tests/ob_reduce_deps.sh
parent0f5caf14a3124c24f38f340fd6504532f07d9617 (diff)
tests/ob_reduce_deps.sh: Convert to TAP
Diffstat (limited to 'tests/ob_reduce_deps.sh')
-rwxr-xr-x[-rw-r--r--]tests/ob_reduce_deps.sh149
1 files changed, 116 insertions, 33 deletions
diff --git a/tests/ob_reduce_deps.sh b/tests/ob_reduce_deps.sh
index 406db0b..fd1a810 100644..100755
--- a/tests/ob_reduce_deps.sh
+++ b/tests/ob_reduce_deps.sh
@@ -17,36 +17,119 @@
# 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
-type=
-host_arch=
-deps=
-result=
-
-main()
-{
- . ./ob_reduce_deps.rc
-
- exit ${ret}
-}
-
-testcase()
-{
- if [ "${type}" != 'u' ]; then
- deps="$(ob_reduce_deps -a "${host_arch}" "${deps}")"
- else
- deps="$(ob_reduce_deps -u -a "${host_arch}" "${deps}")"
- fi
-
- if [ "${deps}" != "${result}" ]; then
- printf 'Dependency list of type "%s" for host arch "%s":\n' \
- "${type}" "${host_arch}"
- printf ' "%s" != "%s"\n' \
- "${deps}" "${result}"
- ret=1
- fi
-}
-
-main "${@}"
+srcdir="$(dirname "${0}")"
+top_builddir="${PWD}"
+
+. "${srcdir}/aux/tap-functions.sh"
+. "${top_builddir}/lib/libopkbuild.shso.1"
+
+plan_ 11
+
+# Normal and union AND-lists.
+
+command_ok_ \
+ 'NORMAL LIST "foo, bar"' -- \
+ [ "$(ob_reduce_deps \
+ -a 'core-linux-eglibc' \
+ 'foo, bar' \
+ )" = \
+ 'foo, bar' \
+ ]
+
+command_ok_ \
+ 'NORMAL LIST "foo,bar"' -- \
+ [ "$(ob_reduce_deps \
+ -a 'core-linux-eglibc' \
+ 'foo,bar' \
+ )" = \
+ 'foo, bar' \
+ ]
+
+command_ok_ \
+ 'NORMAL LIST "foo, bar"' -- \
+ [ "$(ob_reduce_deps \
+ -a 'core-linux-eglibc' \
+ 'foo, bar' \
+ )" = \
+ 'foo, bar' \
+ ]
+
+command_ok_ \
+ 'UNION LIST "foo, bar"' -- \
+ [ "$(ob_reduce_deps \
+ -u \
+ -a 'core-linux-eglibc' \
+ 'foo, bar' \
+ )" = \
+ 'foo, bar' \
+ ]
+
+command_ok_ \
+ 'UNION LIST "foo,bar"' -- \
+ [ "$(ob_reduce_deps \
+ -u \
+ -a 'core-linux-eglibc' \
+ 'foo,bar' \
+ )" = \
+ 'foo, bar' \
+ ]
+
+command_ok_ \
+ 'UNION LIST "foo, bar"' -- \
+ [ "$(ob_reduce_deps \
+ -u \
+ -a 'core-linux-eglibc' \
+ 'foo, bar' \
+ )" = \
+ 'foo, bar' \
+ ]
+
+# Normal and union OR-lists.
+
+command_ok_ \
+ 'NORMAL LIST "foo | bar"' -- \
+ [ "$(ob_reduce_deps \
+ -a 'core-linux-eglibc' \
+ 'foo | bar' \
+ )" = \
+ 'foo | bar' \
+ ]
+
+command_ok_ \
+ 'NORMAL LIST "foo|bar"' -- \
+ [ "$(ob_reduce_deps \
+ -a 'core-linux-eglibc' \
+ 'foo|bar' \
+ )" = \
+ 'foo | bar' \
+ ]
+
+command_ok_ \
+ 'NORMAL LIST "foo | bar"' -- \
+ [ "$(ob_reduce_deps \
+ -a 'core-linux-eglibc' \
+ 'foo | bar' \
+ )" = \
+ 'foo | bar' \
+ ]
+
+# Normal and union AND-lists with arch specs.
+
+command_ok_ \
+ 'NORMAL LIST "foo [core-linux-eglibc], bar [!core-linux-eglibc]"' -- \
+ [ "$(ob_reduce_deps \
+ -a 'core-linux-eglibc' \
+ 'foo [core-linux-eglibc], bar [!core-linux-eglibc]' \
+ )" = \
+ 'foo' \
+ ]
+
+command_ok_ \
+ 'UNION LIST "foo [core-linux-eglibc], bar [!core-linux-eglibc]"' -- \
+ [ "$(ob_reduce_deps \
+ -u \
+ -a 'core-linux-eglibc' \
+ 'foo [core-linux-eglibc], bar [!core-linux-eglibc]' \
+ )" = \
+ 'foo' \
+ ]