Function Reference
— Function File: fail (code,pattern)
— Function File: fail (code,'warning',pattern)

Return true if code fails with an error message matching pattern, otherwise produce an error. Note that code is a string and if code runs successfully, the error produced is:

                    expected error but got none

If the code fails with a different error, the message produced is:

                    expected <pattern>
                    but got <text of actual error>

The angle brackets are not part of the output.

Called with three arguments, the behavior is similar to fail(code, pattern), but produces an error if no warning is given during code execution or if the code fails.