Skip to content

Commit 1b029c3

Browse files
committed
refac(object_m_test): enable selective testing
1 parent 308ef70 commit 1b029c3

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

test/object_m_test.f90 renamed to test/object_m_test.F90

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module 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

Comments
 (0)