summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Paleino <dapal@debian.org>2012-06-17 20:09:53 +0200
committerDavid Paleino <dapal@debian.org>2012-06-17 20:09:53 +0200
commit30649a02707d24744853f84946f744fdcf7c2757 (patch)
tree97d1a69318079910c4bdc1bbed8a2ba2f58aea7f /test
parentc3d398fcc6e400be546c28eb1fc25abfa5816eac (diff)
downloadbash-completion-30649a02707d24744853f84946f744fdcf7c2757.tar.gz
Imported Upstream version 2.0upstream/2.0
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am2
-rw-r--r--test/Makefile.in62
-rw-r--r--test/completion/acpi.exp1
-rw-r--r--test/completion/hwclock.exp1
-rw-r--r--test/completion/modinfo.exp1
-rw-r--r--test/completion/modprobe.exp1
-rw-r--r--test/completion/pwd.exp1
-rw-r--r--test/completion/rmmod.exp1
-rw-r--r--test/completion/ssh-add.exp1
-rw-r--r--test/completion/su.exp1
-rw-r--r--test/completion/vmstat.exp1
-rw-r--r--test/fixtures/_filedir/brackets/[x]1
-rw-r--r--test/fixtures/_filedir/brackets/x1
-rw-r--r--test/lib/completions/acpi.exp18
-rw-r--r--test/lib/completions/hwclock.exp18
-rw-r--r--test/lib/completions/insmod.exp2
-rw-r--r--test/lib/completions/modinfo.exp35
-rw-r--r--test/lib/completions/modprobe.exp49
-rw-r--r--test/lib/completions/pwd.exp18
-rw-r--r--test/lib/completions/rmmod.exp18
-rw-r--r--test/lib/completions/slapt-get.exp6
-rw-r--r--test/lib/completions/ssh-add.exp20
-rw-r--r--test/lib/completions/su.exp18
-rw-r--r--test/lib/completions/sudo.exp9
-rw-r--r--test/lib/completions/vmstat.exp18
-rw-r--r--test/lib/library.exp2
-rw-r--r--test/unit/_filedir.exp6
27 files changed, 296 insertions, 16 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 82f6df90..19d75573 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -8,7 +8,7 @@ EXTRA_DIST = completion \
unit
all:
- $(mkdir_p) log tmp
+ $(MKDIR_P) log tmp
distclean-local:
rm -rf log tmp
diff --git a/test/Makefile.in b/test/Makefile.in
index d71b99ae..337f7425 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,6 +15,23 @@
@SET_MAKE@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -42,6 +59,11 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
EXPECT = expect
RUNTEST = runtest
@@ -170,7 +192,7 @@ CTAGS:
check-DEJAGNU: site.exp
- srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+ srcdir='$(srcdir)'; export srcdir; \
EXPECT=$(EXPECT); export EXPECT; \
runtest=$(RUNTEST); \
if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
@@ -181,16 +203,23 @@ check-DEJAGNU: site.exp
else echo "WARNING: could not find \`runtest'" 1>&2; :;\
fi; \
exit $$exit_status
-site.exp: Makefile
+site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
@echo 'Making a new site.exp file...'
@echo '## these variables are automatically generated by make ##' >site.tmp
@echo '# Do not edit here. If you wish to override these values' >>site.tmp
@echo '# edit the last section' >>site.tmp
- @echo 'set srcdir $(srcdir)' >>site.tmp
+ @echo 'set srcdir "$(srcdir)"' >>site.tmp
@echo "set objdir `pwd`" >>site.tmp
- @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
- @test ! -f site.exp || \
- sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
+ @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \
+ echo "## Begin content included from file $$f. Do not modify. ##" \
+ && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \
+ && echo "## End content included from file $$f. ##" \
+ || exit 1; \
+ done >> site.tmp
+ @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp
+ @if test -f site.exp; then \
+ sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \
+ fi
@-rm -f site.bak
@test ! -f site.exp || mv site.exp site.bak
@mv site.tmp site.exp
@@ -246,10 +275,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
@@ -343,7 +377,7 @@ uninstall-am:
all:
- $(mkdir_p) log tmp
+ $(MKDIR_P) log tmp
distclean-local:
rm -rf log tmp
diff --git a/test/completion/acpi.exp b/test/completion/acpi.exp
new file mode 100644
index 00000000..934f6d1c
--- /dev/null
+++ b/test/completion/acpi.exp
@@ -0,0 +1 @@
+assert_source_completions acpi
diff --git a/test/completion/hwclock.exp b/test/completion/hwclock.exp
new file mode 100644
index 00000000..b0bdb8ed
--- /dev/null
+++ b/test/completion/hwclock.exp
@@ -0,0 +1 @@
+assert_source_completions hwclock
diff --git a/test/completion/modinfo.exp b/test/completion/modinfo.exp
new file mode 100644
index 00000000..88384543
--- /dev/null
+++ b/test/completion/modinfo.exp
@@ -0,0 +1 @@
+assert_source_completions modinfo
diff --git a/test/completion/modprobe.exp b/test/completion/modprobe.exp
new file mode 100644
index 00000000..405ca8e1
--- /dev/null
+++ b/test/completion/modprobe.exp
@@ -0,0 +1 @@
+assert_source_completions modprobe
diff --git a/test/completion/pwd.exp b/test/completion/pwd.exp
new file mode 100644
index 00000000..e24ee974
--- /dev/null
+++ b/test/completion/pwd.exp
@@ -0,0 +1 @@
+assert_source_completions pwd
diff --git a/test/completion/rmmod.exp b/test/completion/rmmod.exp
new file mode 100644
index 00000000..040c7372
--- /dev/null
+++ b/test/completion/rmmod.exp
@@ -0,0 +1 @@
+assert_source_completions rmmod
diff --git a/test/completion/ssh-add.exp b/test/completion/ssh-add.exp
new file mode 100644
index 00000000..03035cf7
--- /dev/null
+++ b/test/completion/ssh-add.exp
@@ -0,0 +1 @@
+assert_source_completions ssh-add
diff --git a/test/completion/su.exp b/test/completion/su.exp
new file mode 100644
index 00000000..8c123fc7
--- /dev/null
+++ b/test/completion/su.exp
@@ -0,0 +1 @@
+assert_source_completions su
diff --git a/test/completion/vmstat.exp b/test/completion/vmstat.exp
new file mode 100644
index 00000000..e55f28e3
--- /dev/null
+++ b/test/completion/vmstat.exp
@@ -0,0 +1 @@
+assert_source_completions vmstat
diff --git a/test/fixtures/_filedir/brackets/[x] b/test/fixtures/_filedir/brackets/[x]
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/test/fixtures/_filedir/brackets/[x]
@@ -0,0 +1 @@
+
diff --git a/test/fixtures/_filedir/brackets/x b/test/fixtures/_filedir/brackets/x
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/test/fixtures/_filedir/brackets/x
@@ -0,0 +1 @@
+
diff --git a/test/lib/completions/acpi.exp b/test/lib/completions/acpi.exp
new file mode 100644
index 00000000..278cdceb
--- /dev/null
+++ b/test/lib/completions/acpi.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "acpi -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/hwclock.exp b/test/lib/completions/hwclock.exp
new file mode 100644
index 00000000..b12951a9
--- /dev/null
+++ b/test/lib/completions/hwclock.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "hwclock -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/insmod.exp b/test/lib/completions/insmod.exp
index a312c894..ca7c30f6 100644
--- a/test/lib/completions/insmod.exp
+++ b/test/lib/completions/insmod.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "insmod in"
+assert_complete_any "insmod "
sync_after_int
diff --git a/test/lib/completions/modinfo.exp b/test/lib/completions/modinfo.exp
new file mode 100644
index 00000000..bd8f965c
--- /dev/null
+++ b/test/lib/completions/modinfo.exp
@@ -0,0 +1,35 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+set test "in<TAB> should complete modulename"
+assert_complete_any "modinfo in" $test
+
+
+sync_after_int
+
+
+set test "should not complete anything for non-existent kernel"
+assert_no_complete "modinfo -k you-dont-have-such-kernel in" $test
+
+
+sync_after_int
+
+
+set test "should complete filepaths"
+assert_complete "/tmp/" "modinfo /tm" $test -nospace
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/modprobe.exp b/test/lib/completions/modprobe.exp
new file mode 100644
index 00000000..a1cd6987
--- /dev/null
+++ b/test/lib/completions/modprobe.exp
@@ -0,0 +1,49 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+set test "--remov<TAB> should complete \"--remove\""
+assert_complete "--remove" "modprobe --remov" $test
+
+
+sync_after_int
+
+
+set test "in<TAB> should complete modulename"
+assert_complete_any "modprobe in" $test
+
+
+sync_after_int
+
+
+set test "should not complete anything for non-existent kernel"
+assert_no_complete "modprobe -S you-dont-have-such-kernel in" $test
+
+
+sync_after_int
+
+
+set test "should not complete anything for non-existent module"
+assert_no_complete "modprobe you-dont-have-such-module " $test
+
+
+sync_after_int
+
+
+set test "should complete filepaths"
+assert_complete "/tmp/" "modprobe /tm" $test -nospace
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pwd.exp b/test/lib/completions/pwd.exp
new file mode 100644
index 00000000..f40fdb99
--- /dev/null
+++ b/test/lib/completions/pwd.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_no_complete "pwd "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rmmod.exp b/test/lib/completions/rmmod.exp
new file mode 100644
index 00000000..6c563211
--- /dev/null
+++ b/test/lib/completions/rmmod.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "rmmod -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/slapt-get.exp b/test/lib/completions/slapt-get.exp
index 70afc666..7f5375a4 100644
--- a/test/lib/completions/slapt-get.exp
+++ b/test/lib/completions/slapt-get.exp
@@ -24,6 +24,12 @@ assert_complete "--update --upgrade" "slapt-get --up" $test
sync_after_int
+set test "--install should not complete anything if config doesn't exist"
+assert_no_complete "slapt-get -c non-existent-file --install " $test
+
+
+sync_after_int
+
set test "--install should complete available packages"
set config $::srcdir/fixtures/slackware/etc/slapt-get/slapt-getrc
diff --git a/test/lib/completions/ssh-add.exp b/test/lib/completions/ssh-add.exp
new file mode 100644
index 00000000..2fb2a9b4
--- /dev/null
+++ b/test/lib/completions/ssh-add.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ssh-add "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/su.exp b/test/lib/completions/su.exp
new file mode 100644
index 00000000..55dd80d1
--- /dev/null
+++ b/test/lib/completions/su.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+assert_complete_any "su "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sudo.exp b/test/lib/completions/sudo.exp
index 6108ddce..5fdb97f1 100644
--- a/test/lib/completions/sudo.exp
+++ b/test/lib/completions/sudo.exp
@@ -32,6 +32,15 @@ assert_complete_dir "default/" "sudo mount /dev/sda1 def" $::srcdir/fixtures/sha
sync_after_int
+set test "sudo -e should complete filenames and directories"
+set dir $::srcdir/fixtures/shared/default
+set files {foo foo.d/}
+assert_complete_dir $files "sudo -e -u root bar foo" $dir $test
+
+
+sync_after_int
+
+
# Find user/group suitable for testing.
set failed_find_unique_completion 0
foreach ug {user group} {
diff --git a/test/lib/completions/vmstat.exp b/test/lib/completions/vmstat.exp
new file mode 100644
index 00000000..f749322a
--- /dev/null
+++ b/test/lib/completions/vmstat.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+assert_complete_any "vmstat -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/library.exp b/test/lib/library.exp
index b2233258..75bf921c 100644
--- a/test/lib/library.exp
+++ b/test/lib/library.exp
@@ -799,6 +799,8 @@ proc realcommand {cmd} {
if [string length [set path [auto_execok $cmd]]] {
if {[string length [auto_execok realpath]]} {
set result [exec realpath $path]
+ } elseif {[string length [auto_execok greadlink]]} {
+ set result [exec greadlink -f $path]
} elseif {[string length [auto_execok readlink]]} {
set result [exec readlink -f $path]
} else {
diff --git a/test/unit/_filedir.exp b/test/unit/_filedir.exp
index 0bba8314..b8cc2009 100644
--- a/test/unit/_filedir.exp
+++ b/test/unit/_filedir.exp
@@ -226,6 +226,12 @@ foreach name {f f2} {
sync_after_int
+ set cmd "$name \\\[x"
+ assert_complete_dir {\[x\]} $cmd "$::srcdir/fixtures/_filedir/brackets"
+
+
+ sync_after_int
+
}; # foreach