aboutsummaryrefslogtreecommitdiff
path: root/t/test_pbuilder-modules
diff options
context:
space:
mode:
Diffstat (limited to 't/test_pbuilder-modules')
-rwxr-xr-xt/test_pbuilder-modules44
1 files changed, 44 insertions, 0 deletions
diff --git a/t/test_pbuilder-modules b/t/test_pbuilder-modules
new file mode 100755
index 0000000..9e1f6e0
--- /dev/null
+++ b/t/test_pbuilder-modules
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+TD="$(dirname "$0")"
+if [ -n "$PBUILDER_CHECKOUT" ]; then
+ . "$TD/testlib.sh"
+ . "$PBUILDER_CHECKOUT/pbuilder-modules"
+else
+ . "$TD/testlib.sh"
+ . "$PBUILDER_TEST_PKGLIBDIR/pbuilder-modules"
+fi
+
+function test_information() {
+ log "I: test"
+ log "W: warning"
+ log "E: error"
+}
+expect_output "I: test
+W: warning
+E: error" test_information
+
+# test the non-copy case
+function test_conditional_cp_a() {
+ (
+ TEMPDIR=$(mktemp -d)
+ cd "${TEMPDIR}"
+ touch "hoge"
+ outdir=$(readlink -f "${TEMPDIR}/..")
+ conditional_cp_a "hoge" "${outdir}" echo
+ )
+}
+expect_output "I: file hoge is already in target, not copying." \
+ test_conditional_cp_a
+
+# test the copy case.
+function test_conditional_cp_a_copy() {
+ (
+ cd /tmp
+ outdir=/something-else
+ conditional_cp_a "hoge" "${outdir}" echo
+ )
+}
+expect_output "-a hoge /something-else" test_conditional_cp_a_copy
+
+testlib_summary