This function checks whether it returns the correct error for a given pattern and text.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | pattern | |||
character(len=*), | intent(in) | :: | text | |||
integer, | intent(in) | :: | expected_err_code | |||
integer, | intent(inout) | :: | return_code |
function is_valid__error (pattern, text, expected_err_code, return_code) result(res) use :: forgex_error_m implicit none character(*), intent(in) :: pattern character(*), intent(in) :: text integer, intent(in) :: expected_err_code integer, intent(inout) :: return_code integer(int32) :: status character(256) :: err_msg character(:), allocatable :: substr logical :: res call regex(pattern, "", substr, status=status, err_msg=err_msg) return_code = status res = (status == expected_err_code) .and. (trim(err_msg) == trim(get_error_message(expected_err_code))) end function is_valid__error