Skip to content

Commit ee9c39a

Browse files
committed
test(pp): add test for preprocessor whitespaces
1 parent aa18a68 commit ee9c39a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/test_preproc_parser.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from __future__ import annotations
2+
3+
from fortls.parsers.internal.parser import preprocess_file
4+
5+
6+
def test_pp_leading_spaces():
7+
lines = [
8+
" #define LEADING_SPACES_INDENT 1",
9+
" # define LEADING_SPACES_INDENT2",
10+
" # define FILE_ENCODING ,encoding='UTF-8'",
11+
"program pp_intentation",
12+
" implicit none",
13+
" print*, LEADING_SPACES_INDENT",
14+
" open(unit=1,file='somefile.txt' FILE_ENCODING)",
15+
"end program pp_intentation",
16+
]
17+
_, _, _, defs = preprocess_file(lines)
18+
ref = {
19+
"LEADING_SPACES_INDENT": "1",
20+
"LEADING_SPACES_INDENT2": "True",
21+
"FILE_ENCODING": ",encoding='UTF-8'",
22+
}
23+
assert defs == ref

0 commit comments

Comments
 (0)