summaryrefslogtreecommitdiff
path: root/test/lib/completions/slapt-src.exp
diff options
context:
space:
mode:
authorDavid Paleino <dapal@debian.org>2011-11-03 12:32:52 +0100
committerDavid Paleino <dapal@debian.org>2011-11-03 12:32:52 +0100
commit2c8171c38d87ddef31c92a76547d3fdf773a1337 (patch)
tree5e720d5a06ead72ed55454bf6647a712a761ed91 /test/lib/completions/slapt-src.exp
parent9920a8faedf704420571d8072ccab27e9dac40ba (diff)
downloadbash-completion-2c8171c38d87ddef31c92a76547d3fdf773a1337.tar.gz
Imported Upstream version 1.90upstream/1.90
Diffstat (limited to 'test/lib/completions/slapt-src.exp')
-rw-r--r--test/lib/completions/slapt-src.exp49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/lib/completions/slapt-src.exp b/test/lib/completions/slapt-src.exp
new file mode 100644
index 00000000..9410f9c1
--- /dev/null
+++ b/test/lib/completions/slapt-src.exp
@@ -0,0 +1,49 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "slapt-src -"
+
+
+sync_after_int
+
+
+set test "--bu<TAB> should complete \"--build\""
+assert_complete "--build" "slapt-src --bu" $test
+
+
+sync_after_int
+
+
+set test "--ins<TAB> should complete \"--install\""
+assert_complete "--install" "slapt-src --ins" $test
+
+
+sync_after_int
+
+
+set test "--install should complete available packages"
+set config $::srcdir/fixtures/slackware/etc/slapt-get/slapt-srcrc
+set workdir [file normalize $::srcdir/fixtures/slackware/usr/src/slapt-src/]
+set slb_data "$workdir/slackbuilds_data"
+set f [open $config w]; puts $f "BUILDDIR=$workdir"; close $f
+set slackbuilds [split [exec bash -c "sed -n \
+ -e '/^SLACKBUILD NAME: /{s/^SLACKBUILD NAME: \\{1,\\}//;p}' \
+ -e '/^SLACKBUILD VERSION: /{s/^SLACKBUILD VERSION: \\{1,\\}//;p}' \
+ $slb_data | sed -e 'N;s/\\n/:/'"] "\n"]
+assert_complete $slackbuilds "slapt-src --config $config --install " $test
+
+
+sync_after_int
+
+
+teardown