diff --git a/check/README.md b/check/README.md index 268d72e9..acb9fa5f 100644 --- a/check/README.md +++ b/check/README.md @@ -245,8 +245,8 @@ The following methods are available in Ruby test programs. `true` if the FORM job issued the expected warning, otherwise `false`. The following methods are similar to `warning?`, -but they check for preprocessor errors, compile-time errors, -and run-time errors, respectively: +but they check for preprocessor errors, compile-time errors, run-time errors, +and internal errors (which should never happen), respectively: - `preprocess_error? → bool` `preprocess_error?(expected_message : string) → bool` @@ -254,6 +254,8 @@ and run-time errors, respectively: `compile_error?(expected_message : string) → bool` - `runtime_error? → bool` `runtime_error?(expected_message : string) → bool` +- `internal_error? → bool` + `internal_error?(expected_message : string) → bool` #### Standard streams diff --git a/check/check.rb b/check/check.rb index 835e5407..0283ba2c 100755 --- a/check/check.rb +++ b/check/check.rb @@ -799,10 +799,19 @@ def runtime_error?(expected_message = nil) end end + # true if the FORM job reported an internal error, which should never happen. + def internal_error?(expected_message = nil) + if expected_message.nil? + @stdout =~ / ~~> Internal error/ + else + @cleaned_stdout =~ / ~~> Internal error.*#{Regexp.escape(expected_message)}/ + end + end + # true if the FORM job completed without any warnings/errors and # the exit code was 0. def succeeded? - if finished? && !warning? && !preprocess_error? && !compile_error? && !runtime_error? && return_value == 0 + if finished? && !warning? && !preprocess_error? && !compile_error? && !runtime_error? && !internal_error? && return_value == 0 if FormTest.cfg.valgrind.nil? if @stderr.empty? return true