From d019c32acd94fb73afadbc8d0d6cf8cc23cde18c Mon Sep 17 00:00:00 2001 From: Ulrich Dangel Date: Fri, 15 Oct 2010 19:44:48 +0200 Subject: [PATCH] Added test for the config_debs function to test the parameter count for the dpkg command. --- tests/test_debs.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 tests/test_debs.sh diff --git a/tests/test_debs.sh b/tests/test_debs.sh new file mode 100755 index 0000000..a1f5aa3 --- /dev/null +++ b/tests/test_debs.sh @@ -0,0 +1,33 @@ +#!/bin/zsh +# This test does not use shunit2 as shunit2 requires shwordsplit +# But shwordsplit is not enabled per default in zsh and needs to be +# taken care of in autoconfig.functions. + +EXPECTED_COUNT=4 +dpkg() { + # remove the -i parameter + shift + + if [ $# -ne $EXPECTED_COUNT ] ; then + echo "wrong parameter count for dpkg, was $# expected $EXPECTED_COUNT" >&2 + exit 1 + fi +} + +test_debs() { + . ../autoconfig.functions + CMDLINE='debs=*' + INSTALLED='' + + TMPDIR=$(mktemp -d) + DCSDIR="$TMPDIR" + DEB_DIR="$DCSDIR"/debs + mkdir -p "$DEB_DIR" + touch "$DEB_DIR"/{1..$EXPECTED_COUNT}.deb + + config_debs + + rm -rf "$TMPDIR" +} + +test_debs -- 2.1.4