Skip to content

Commit

Permalink
test(make): add test cases for GitHub scop#544
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Jun 20, 2021
1 parent 53060e3 commit eb12832
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/t/test_make.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import pytest

from conftest import assert_complete


class TestMake:
@pytest.mark.complete("make -f Ma", cwd="make")
Expand Down Expand Up @@ -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"

0 comments on commit eb12832

Please sign in to comment.