Skip to content

Commit 8c869bc

Browse files
committed
test(pp): add macro expansion test
We don't actually do the full C expansion, as it can be seen by the C-style comment character still present in the output, but it's better than no expansion at all.
1 parent 22bbf84 commit 8c869bc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/test_preproc_parser.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,18 @@ def test_pp_leading_spaces():
1717
"FILE_ENCODING": ",encoding='UTF-8'",
1818
}
1919
assert defs == ref
20+
21+
22+
def test_pp_macro_expansion():
23+
lines = [
24+
"# define WRAP(PROCEDURE) PROCEDURE , wrap_/**/PROCEDURE",
25+
"generic, public :: set => WRAP(abc)",
26+
"procedure :: WRAP(abc)",
27+
]
28+
ref = [
29+
"# define WRAP(PROCEDURE) PROCEDURE , wrap_/**/PROCEDURE",
30+
"generic, public :: set => abc , wrap_/**/abc",
31+
"procedure :: abc , wrap_/**/abc",
32+
]
33+
output, _, _, _ = preprocess_file(lines)
34+
assert output == ref

0 commit comments

Comments
 (0)