Skip to content
Snippets Groups Projects
Commit 1e94d01c authored by Simon Rose's avatar Simon Rose
Browse files

Added test for missing source file

parent 55c46933
No related branches found
No related tags found
1 merge request!38E3-233: Add tests
import re
import pytest
from .utils import TEST_MODULE_NAME, run_make
......@@ -5,6 +7,8 @@ from .utils import TEST_MODULE_NAME, run_make
MODULE_VERSION = "0.0.0+0"
MODULE_VERSION_NO_BUILD = "0.0.0"
RE_MISSING_FILE = "No rule to make target [`']{filename}'"
DB_FILE = """record(ai, "TEST") {
}
......@@ -75,10 +79,26 @@ def test_patch(wrapper):
[{"templates": "", "sources": "", "dbds": "nonexistent.dbd", "headers": ""}],
indirect=True,
)
def test_missing_file(wrapper):
def test_missing_dbd_file(wrapper):
rc, _, errs = run_make(wrapper, "build")
# TODO: This should probably be a regex, since the quote marks seem to
# depend on the make version.
assert "No rule to make target `../nonexistent.dbd'" in errs.decode("utf-8")
assert rc == 2
assert re.search(
RE_MISSING_FILE.format(filename=re.escape("../nonexistent.dbd")),
errs.decode("utf-8"),
)
@pytest.mark.parametrize(
"wrapper",
[{"templates": "", "sources": "nonexistent.c", "dbds": "", "headers": ""}],
indirect=True,
)
def test_missing_source_file(wrapper):
rc, _, errs = run_make(wrapper, "build")
assert rc == 2
assert re.search(
RE_MISSING_FILE.format(filename=re.escape("nonexistent.o")),
errs.decode("utf-8"),
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment