Skip to content

Commit 008fe94

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 90b8ac5 commit 008fe94

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
@@ -21,3 +21,18 @@ def test_pp_leading_spaces():
2121
"FILE_ENCODING": ",encoding='UTF-8'",
2222
}
2323
assert defs == ref
24+
25+
26+
def test_pp_macro_expansion():
27+
lines = [
28+
"# define WRAP(PROCEDURE) PROCEDURE , wrap_/**/PROCEDURE",
29+
"generic, public :: set => WRAP(abc)",
30+
"procedure :: WRAP(abc)",
31+
]
32+
ref = [
33+
"# define WRAP(PROCEDURE) PROCEDURE , wrap_/**/PROCEDURE",
34+
"generic, public :: set => abc , wrap_/**/abc",
35+
"procedure :: abc , wrap_/**/abc",
36+
]
37+
output, _, _, _ = preprocess_file(lines)
38+
assert output == ref

0 commit comments

Comments
 (0)