Skip to content

Commit 981b190

Browse files
committed
refac(command_line_test): enable selective testing
1 parent 1b029c3 commit 981b190

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

test/command_line_test.f90

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module command_line_test_m
22
!! Verify object pattern asbtract parent
3-
use sourcery_m, only : test_t, test_result_t, command_line_t
3+
use sourcery_m, only : &
4+
test_t, test_result_t, command_line_t, test_description_substring, test_function_i, string_t, test_description_t
45
implicit none
56

67
private
@@ -21,10 +22,21 @@ pure function subject() result(specimen)
2122

2223
function results() result(test_results)
2324
type(test_result_t), allocatable :: test_results(:)
24-
25-
test_results = [ &
26-
test_result_t("returning the value passed after a command-line flag", check_flag_value()) &
27-
]
25+
type(test_description_t), allocatable :: test_descriptions(:)
26+
#ifndef __GFORTRAN__
27+
test_descriptions = [ &
28+
test_description_t(string_t("returning the value passed after a command-line flag"), check_flag_value) &
29+
]
30+
#else
31+
! Work around missing Fortran 2008 feature: associating a procedure actual argument with a procedure pointer dummy argument:
32+
procedure(test_function_i), pointer :: check_flag_ptr
33+
check_flag_ptr => check_flag_value
34+
test_descriptions = [ &
35+
test_description_t(string_t("returning the value passed after a command-line flag"), check_flag_ptr) &
36+
]
37+
#endif
38+
test_descriptions = pack(test_descriptions, test_descriptions%contains_text(string_t(test_description_substring)))
39+
test_results = test_descriptions%run()
2840
end function
2941

3042
function check_flag_value() result(test_passes)

0 commit comments

Comments
 (0)