@@ -29,16 +29,19 @@ function results() result(test_results)
29
29
#ifndef __GFORTRAN__
30
30
test_descriptions = [ &
31
31
test_description_t(string_t(" returning the value passed after a command-line flag" ), check_flag_value), &
32
- test_description_t(string_t(" returning an empty string when a flag value is missing" ), handle_missing_flag_value) &
32
+ test_description_t(string_t(" returning an empty string when a flag value is missing" ), handle_missing_flag_value), &
33
+ test_description_t(string_t(" detecting a present command-line argument" ), check_command_line_argument) &
33
34
]
34
35
#else
35
36
! Work around missing Fortran 2008 feature: associating a procedure actual argument with a procedure pointer dummy argument:
36
- procedure (test_function_i), pointer :: check_flag_ptr, handle_missing_value_ptr
37
+ procedure (test_function_i), pointer :: check_flag_ptr, handle_missing_value_ptr, check_command_ptr
37
38
check_flag_ptr = > check_flag_value
38
39
handle_missing_value_ptr = > handle_missing_flag_value
40
+ check_command_ptr = > check_command_line_argument
39
41
test_descriptions = [ &
40
42
test_description_t(string_t(" returning the value passed after a command-line flag" ), check_flag_ptr), &
41
- test_description_t(string_t(" returning an empty string when a flag value is missing" ), handle_missing_value_ptr) &
43
+ test_description_t(string_t(" returning an empty string when a flag value is missing" ), handle_missing_value_ptr), &
44
+ test_description_t(string_t(" detecting a present command-line argument" ), check_command_ptr) &
42
45
]
43
46
#endif
44
47
test_descriptions = pack (test_descriptions, &
@@ -71,4 +74,16 @@ function handle_missing_flag_value() result(test_passes)
71
74
test_passes = exit_status == 0
72
75
end function
73
76
77
+ function check_command_line_argument () result(test_passes)
78
+ logical test_passes
79
+ integer exit_status, command_status
80
+ character (len= 132 ) command_message
81
+
82
+ call execute_command_line( &
83
+ command = " fpm run --example check-command-line-argument -- --some-argument" , &
84
+ wait = .true. , exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message &
85
+ )
86
+ test_passes = exit_status == 0
87
+ end function
88
+
74
89
end module command_line_test_m
0 commit comments