Skip to content

Commit a5d6e8f

Browse files
committed
test: Update test for preprocessor #elif parsing
Only content from the true branch should be in the final parsed file
1 parent 10dc58f commit a5d6e8f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

test/test_preproc.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ def check_return(result_array, checks):
3434
string += hover_req(file_path, 8, 12)
3535
string += hover_req(file_path, 18, 12)
3636
file_path = root_dir / "preproc_elif.F90"
37-
string += hover_req(file_path, 10, 12)
38-
string += hover_req(file_path, 14, 15)
37+
string += hover_req(file_path, 15, 12)
38+
string += hover_req(file_path, 19, 15)
39+
string += hover_req(file_path, 21, 10)
3940
config = str(root_dir / ".pp_conf.json")
4041
errcode, results = run_request(string, ["--config", config])
4142
assert errcode == 0
@@ -59,6 +60,7 @@ def check_return(result_array, checks):
5960
"```fortran90\nREAL :: var1\n```",
6061
"```fortran90\nLOGICAL :: var1\n```",
6162
"```fortran90\nINTEGER :: var2\n```",
63+
"```fortran90\nINTEGER, INTENT(INOUT) :: var\n```",
6264
)
6365
assert len(ref_results) == len(results) - 1
6466
check_return(results[1:], ref_results)

test/test_source/pp/preproc_elif.F90

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ subroutine preprocessor_elif(var)
22

33
#if 0
44
#define MYTYPE character
5+
integer, intent(in) :: var
56
#elif 1
67
#define MYTYPE logical
8+
integer, intent(inout) :: var
9+
var = 3
710
#else
811
#define MYTYPE integer
12+
integer, intent(out) :: var
13+
var = 5
914
#endif
1015

1116
MYTYPE :: var1
@@ -14,4 +19,6 @@ subroutine preprocessor_elif(var)
1419

1520
OTHERTYPE :: var2
1621

22+
PRINT*, var
23+
1724
endsubroutine preprocessor_elif

0 commit comments

Comments
 (0)