diff options
author | Igor Murzov <e-mail@date.by> | 2011-11-08 04:00:46 +0300 |
---|---|---|
committer | Igor Murzov <e-mail@date.by> | 2011-11-09 04:54:31 +0300 |
commit | d48d9ebd2f5013cdacf9657b0d240c5905045fa7 (patch) | |
tree | 3c839a9e0f38b34dd047be33f268de47989a4878 | |
parent | fff412b2f2b83e10de8644acbb90535355b39b93 (diff) | |
download | bash-completion-d48d9ebd2f5013cdacf9657b0d240c5905045fa7.tar.gz |
testsuite: Add some make test cases.
-rw-r--r-- | test/fixtures/make/Makefile | 16 | ||||
-rw-r--r-- | test/fixtures/make/empty_dir/.nothing_here | 0 | ||||
-rw-r--r-- | test/fixtures/make/sample.c | 7 | ||||
-rw-r--r-- | test/lib/completions/make.exp | 23 |
4 files changed, 44 insertions, 2 deletions
diff --git a/test/fixtures/make/Makefile b/test/fixtures/make/Makefile new file mode 100644 index 00000000..1a6416cd --- /dev/null +++ b/test/fixtures/make/Makefile @@ -0,0 +1,16 @@ +NAME := sample + +.PHONY: all +all: $(NAME) + +$(NAME): sample.c + cc -o $@ $^ + +.PHONY: install +install: all + mkdir -p /usr/bin + install -m 755 $(NAME) /usr/bin + +.PHONY: clean +clean: + -rm -f $(NAME) diff --git a/test/fixtures/make/empty_dir/.nothing_here b/test/fixtures/make/empty_dir/.nothing_here new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/make/empty_dir/.nothing_here diff --git a/test/fixtures/make/sample.c b/test/fixtures/make/sample.c new file mode 100644 index 00000000..2be4600f --- /dev/null +++ b/test/fixtures/make/sample.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main(void) +{ + puts("Hello, world!"); + return 0; +} diff --git a/test/lib/completions/make.exp b/test/lib/completions/make.exp index 64a393da..f20ace19 100644 --- a/test/lib/completions/make.exp +++ b/test/lib/completions/make.exp @@ -4,14 +4,33 @@ proc setup {} { proc teardown {} { - assert_env_unmodified + assert_env_unmodified {/OLDPWD=/d} } setup -assert_complete_any "make " +set test "-f Ma<TAB> should complete \"Makefile\"" +set dir $::srcdir/fixtures/make +assert_complete_dir "Makefile" "make -f Ma" $dir $test + + +sync_after_int + + +set test "\"make <TAB>\" should complete targets" +set dir $::srcdir/fixtures/make +set targets "all sample install clean" +assert_complete_dir $targets "make " $dir $test + + +sync_after_int + + +set test "\"make <TAB>\" should not show anything in directory without makefile" +set dir $::srcdir/fixtures/make/empty_dir +assert_complete_dir "" "make " $dir $test sync_after_int |