Skip to content

Commit faf6d7e

Browse files
committed
test: Add test for preprocessor #elif parsing
1 parent 21bd331 commit faf6d7e

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

test/test_preproc.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ def check_return(result_array, checks):
3333
file_path = root_dir / "preproc_else.F90"
3434
string += hover_req(file_path, 8, 12)
3535
string += hover_req(file_path, 18, 12)
36+
file_path = root_dir / "preproc_elif.F90"
37+
string += hover_req(file_path, 10, 12)
38+
string += hover_req(file_path, 14, 15)
3639
config = str(root_dir / ".pp_conf.json")
3740
errcode, results = run_request(string, ["--config", config])
3841
assert errcode == 0
@@ -54,6 +57,8 @@ def check_return(result_array, checks):
5457
"```fortran90\nREAL, CONTIGUOUS, POINTER, DIMENSION(:) :: var1\n```",
5558
"```fortran90\nINTEGER :: var0\n```",
5659
"```fortran90\nREAL :: var1\n```",
60+
"```fortran90\nLOGICAL :: var1\n```",
61+
"```fortran90\nINTEGER :: var2\n```",
5762
)
5863
assert len(ref_results) == len(results) - 1
5964
check_return(results[1:], ref_results)

test/test_source/pp/preproc_elif.F90

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
subroutine preprocessor_elif(var)
2+
3+
#if 0
4+
#define MYTYPE character
5+
#elif 1
6+
#define MYTYPE logical
7+
#else
8+
#define MYTYPE integer
9+
#endif
10+
11+
MYTYPE :: var1
12+
13+
#define OTHERTYPE integer
14+
15+
OTHERTYPE :: var2
16+
17+
endsubroutine preprocessor_elif

0 commit comments

Comments
 (0)