From: Ulrich Dangel Date: Fri, 15 Oct 2010 17:44:48 +0000 (+0200) Subject: Added test for the config_debs function to test the parameter count for the dpkg... X-Git-Tag: v0.9.14~4 X-Git-Url: https://git.grml.org/?p=grml-autoconfig.git;a=commitdiff_plain;h=d019c32acd94fb73afadbc8d0d6cf8cc23cde18c;ds=sidebyside Added test for the config_debs function to test the parameter count for the dpkg command. --- 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