From ae8b8dda05d15f115481e64a848431a127ebb59f Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Sun, 20 Jun 2021 11:00:54 +0900 Subject: [PATCH] test(make): add test cases for GitHub #544 --- test/fixtures/make/test2/Makefile | 7 +++++++ test/t/test_make.py | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 test/fixtures/make/test2/Makefile diff --git a/test/fixtures/make/test2/Makefile b/test/fixtures/make/test2/Makefile new file mode 100644 index 00000000000..71adba98420 --- /dev/null +++ b/test/fixtures/make/test2/Makefile @@ -0,0 +1,7 @@ +# makefile + +all: abc/xyz +.PHONY: abc/xyz +abc/xyz 123/xaa 123/xbb: + mkdir -p $(@:/%=) + date > $@ diff --git a/test/t/test_make.py b/test/t/test_make.py index aaf5fead14d..3bd6f8b6092 100644 --- a/test/t/test_make.py +++ b/test/t/test_make.py @@ -2,6 +2,8 @@ import pytest +from conftest import assert_complete + class TestMake: @pytest.mark.complete("make -f Ma", cwd="make") @@ -45,3 +47,22 @@ def test_8(self, bash, completion): @pytest.mark.complete("make -", require_cmd=True) def test_9(self, completion): assert completion + + +@pytest.mark.bashcomp(require_cmd=True, cwd="make/test2") +class TestMake2: + def test_github_issue_544_1(self, bash): + completion = assert_complete(bash, "make ab") + assert completion == "c/xyz" + + def test_github_issue_544_2(self, bash): + completion = assert_complete(bash, "make 1") + assert completion == "23/" + + def test_github_issue_544_3(self, bash): + completion = assert_complete(bash, "make 123/") + assert completion == ["xaa", "xbb"] + + def test_github_issue_544_4(self, bash): + completion = assert_complete(bash, "make 123/xa") + assert completion == "a"