11module object_m_test_m
22 ! ! Verify object pattern asbtract parent
3- use sourcery_m, only : test_t, test_result_t, object_t
3+ use sourcery_m, only : test_t, test_result_t, object_t, test_description_t, test_function_i, string_t, test_description_substring
44 implicit none
55
66 private
@@ -26,11 +26,26 @@ pure function subject() result(specimen)
2626
2727 function results () result(test_results)
2828 type (test_result_t), allocatable :: test_results(:)
29+ type (test_description_t), allocatable :: test_descriptions(:)
30+
31+ #ifndef __GFORTRAN__
32+ test_descriptions = [ &
33+ test_description_t(string_t(" object being .not. user_defined() if it is only default-initialized" ), check_default_initialization), &
34+ test_description_t(string_t(" object being user_defined() after call to mark_as_defined" ), check_mark_as_defined) &
35+ ]
36+ #else
37+ ! Work around missing Fortran 2008 feature: associating a procedure actual argument with a procedure pointer dummy argument:
38+ procedure (test_function_i), pointer :: check_default_ptr, check_mark_ptr
39+ check_default_ptr = > check_default_initialization
40+ check_mark_ptr = > check_mark_as_defined
41+ test_descriptions = [ &
42+ test_description_t(string_t(" object being .not. user_defined() if it is only default-initialized" ), check_default_ptr), &
43+ test_description_t(string_t(" object being user_defined() after call to mark_as_defined" ), check_mark_ptr) &
44+ ]
45+ #endif
46+ test_descriptions = pack (test_descriptions, test_descriptions% contains_text(string_t(test_description_substring)))
47+ test_results = test_descriptions% run()
2948
30- test_results = [ &
31- test_result_t(" object being .not. user_defined() if it is only default-initialized" , check_default_initialization()), &
32- test_result_t(" object being user_defined() after call to mark_as_defined" , check_mark_as_defined()) &
33- ]
3449 end function
3550
3651 pure function check_default_initialization () result(passed)
0 commit comments