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

Fix issue with multiple records that include dbCommon.dbd

parent 7aa82814
No related branches found
No related tags found
No related merge requests found
......@@ -39,9 +39,10 @@ def open_dbd_file(current_file, filename, includes=None):
if dbd_file is None:
print("File '{basename}' not found".format(basename=basename), file=sys.stderr)
sys.exit(1)
SCANNED_FILES.add(basename)
if basename != "dbCommon.dbd":
SCANNED_FILES.add(basename)
with open(dbd_file, "r") as f:
return [line.strip() for line in f.readlines()]
return [line.rstrip() for line in f.readlines()]
def expand_dbd_file(current_file, dbdlines, includes):
......
......@@ -60,6 +60,23 @@ def test_skip_repeated_includes(tmp_path, expanddbdtcl):
assert "Info: skipping duplicate file b.dbd included from" in result.stderr
def test_do_not_skip_repeated_include_common_dbd(tmp_path, expanddbdtcl):
dbd_a = tmp_path / "a.dbd"
dbd_a.write_text("include dbCommon.dbd\ninclude dbCommon.dbd")
dbd_b = tmp_path / "dbCommon.dbd"
dbd_b.write_text("content")
result = subprocess.run(
[expanddbdtcl, "-I", str(tmp_path), dbd_a],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
)
assert result.returncode == 0
assert result.stdout == "content\ncontent\n"
def test_record_names_from_dbds(tmp_path, expanddbdtcl):
dbd_a = tmp_path / "a.dbd"
dbd_a.write_text("include aRecord.dbd")
......
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