Skip to content

Commit 5d4739a

Browse files
committed
add ifdef elif else test
1 parent 23899f2 commit 5d4739a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/fpm_test/test_source_parsing.f90

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,10 @@ subroutine test_conditional_compilation(error)
13101310
'module test_mod', &
13111311
'#ifdef SOME_FEATURE', &
13121312
' use nonexistent_module', &
1313+
'#elif defined(ANOTHER_FEATURE)', &
1314+
' use another_nonexistent_module', &
1315+
'#else',&
1316+
' use a_third_module',&
13131317
'#endif', &
13141318
' implicit none', &
13151319
'contains', &
@@ -1323,8 +1327,8 @@ subroutine test_conditional_compilation(error)
13231327
f_source = parse_f_source(temp_file, error)
13241328
if (allocated(error)) return
13251329

1326-
if (size(f_source%modules_used) /= 1) then
1327-
call test_failed(error, 'Expected 1 module dependency without preprocessing, got different count')
1330+
if (size(f_source%modules_used) /= 3) then
1331+
call test_failed(error, 'Expected 3 module dependency without preprocessing, got different count')
13281332
return
13291333
end if
13301334

@@ -1340,8 +1344,8 @@ subroutine test_conditional_compilation(error)
13401344
f_source = parse_f_source(temp_file, error, preprocess=cpp_config)
13411345
if (allocated(error)) return
13421346

1343-
if (size(f_source%modules_used) /= 0) then
1344-
call test_failed(error, 'Expected 0 module dependencies with preprocessing, got some dependencies')
1347+
if (size(f_source%modules_used) /= 1) then
1348+
call test_failed(error, 'Expected 1 module dependencies with preprocessing, got some dependencies')
13451349
return
13461350
end if
13471351

0 commit comments

Comments
 (0)