-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(pp): add test for preprocessor whitespaces
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from __future__ import annotations | ||
|
||
from setup_tests import test_dir | ||
|
||
from fortls.parsers.internal.parser import preprocess_file | ||
|
||
|
||
def test_pp_leading_spaces(): | ||
root_dir = test_dir / "pp" / "leading_spaces" | ||
file_path = root_dir / "spaces.F90" | ||
with open(file_path, encoding="utf-8") as file: | ||
lines = file.readlines() | ||
_, _, _, defs = preprocess_file(lines) | ||
ref = { | ||
"LEADING_SPACES_INDENT": "1", | ||
"LEADING_SPACES_INDENT2": "True", | ||
"FILE_ENCODING": ",encoding='UTF-8'", | ||
} | ||
assert defs == ref |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#define LEADING_SPACES_INDENT 1 | ||
# define LEADING_SPACES_INDENT2 | ||
# define FILE_ENCODING ,encoding='UTF-8' | ||
program pp_intentation | ||
implicit none | ||
print*, LEADING_SPACES_INDENT | ||
open(unit=1,file='somefile.txt' FILE_ENCODING) | ||
end program pp_intentation |