From eb12832c7195fbfb4885bf98aaa2a1598cfe5909 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/t/test_make.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/test/t/test_make.py b/test/t/test_make.py index aaf5fead14d..4d334610a81 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,32 @@ 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, temp_cwd=True) +class TestMake2: + def test_github_issue_544_1(self, bash): + print(os.getcwd()) + print(bash.cwd) + with open("Makefile", "w") as f: + f.write( + "all: abc/xyz\n" + ".PHONY: abc/xyz\n" + "abc/xyz 123/xaa 123/xbb:\n" + "\tmkdir -p $(@:/%=)\n" + "\tdate > $@\n" + ) + 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"