@@ -3,6 +3,7 @@ module compiler_test
3
3
! ! standard mandates type finalization.
4
4
use for_use_in_spec_expr_m, only: finalizable_t, component, was_finalized
5
5
use veggies, only: result_t, test_item_t, describe, it, assert_equals, assert_that
6
+ use iso_fortran_env, only : compiler_version
6
7
implicit none
7
8
8
9
private
@@ -200,15 +201,36 @@ function check_specification_expression() result(result_)
200
201
! ! Test conformance with Fortran 2018 standard clause 7.5.6.3, paragraph 6:
201
202
! ! "specification expression function result"
202
203
type (result_t) result_
204
+ integer exit_status
205
+ logical error_termination_occurred
206
+
207
+ call execute_command_line( &
208
+ command = " fpm run --example specification_expression_finalization " // fpm_compiler_arguments() // " > /dev/null 2>&1" , &
209
+ wait = .true. , &
210
+ exitstat = exit_status &
211
+ )
212
+ error_termination_occurred = exit_status /= 0
213
+ result_ = assert_that(error_termination_occurred)
203
214
204
- call try_it
205
- result_ = assert_that(was_finalized)
206
215
contains
207
- subroutine try_it
208
- real tmp(component(finalizable_t(component= 0 ))) ! ! Finalizes the finalizable_t function result
209
- end subroutine
216
+
217
+ pure function fpm_compiler_arguments () result(args)
218
+ character (len= :), allocatable :: args
219
+
220
+ associate(compiler_identity= >compiler_version())
221
+ if (scan (compiler_identity, " GCC " )==1 ) then
222
+ args = " "
223
+ else if (scan (compiler_identity, " NAG Fortran " )==1 ) then
224
+ args = " --compiler nagfor --flag -fpp"
225
+ else
226
+ error stop " ----> Unrecognized compiler_version() in function fpm_compiler_arguments. <----"
227
+ end if
228
+ end associate
229
+ end function
230
+
210
231
end function
211
232
233
+
212
234
function check_intent_out_finalization () result(result_)
213
235
! ! Test conformance with Fortran 2018 standard clause 7.5.6.3, paragraph 7:
214
236
! ! "nonpointer, nonallocatable, INTENT (OUT) dummy argument"
0 commit comments