Skip to content

Commit cf820b7

Browse files
committed
add tests for invalid flags
1 parent 511d002 commit cf820b7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/fpm_test/test_compiler.f90

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,24 @@ subroutine test_check_fortran_source_runs(error)
5151
call test_failed(error, "Cannot run Fortran hello world")
5252
return
5353
end if
54+
55+
!> Test with invalid flags
56+
if (compiler%check_fortran_source_runs("print *, 'Hello world!'; end", &
57+
link_flags=" -some-really-invalid-link-flag")) then
58+
call test_failed(error, "Invalid link flags did not trigger an error")
59+
return
60+
end if
61+
if (compiler%check_fortran_source_runs("print *, 'Hello world!'; end", &
62+
compile_flags=" -certainly-not-a-build/flag")) then
63+
call test_failed(error, "Invalid compile flags did not trigger an error")
64+
return
65+
end if
66+
if (compiler%check_fortran_source_runs("print *, 'Hello world!'; end", &
67+
compile_flags=" -certainly-not-a-build/flag", &
68+
link_flags=" -some-really-invalid-link-flag")) then
69+
call test_failed(error, "Invalid build and link flags did not trigger an error")
70+
return
71+
end if
5472

5573
end subroutine test_check_fortran_source_runs
5674

0 commit comments

Comments
 (0)