atExpectStop(expr, expected = ".")
expr | An expression to evaluate. It will be taken literally, as in system.time(). |
expected | A regular expression that matches the expected error message. See regexpr for the syntax; "." matches any message. |
## Not run: # The following may be put into a test.t file # and run by assertionTest. The first should return TRUE. atExpectStop(lm(y ~ noSuchData), expected="noSuchData.*not found") # expect complaints from the following two: atExpectStop(stop("Oops"), expected="a problem happened") atExpectStop(1L+2L == 3L, expected="integer arithment overflow")# Run example test files in assertionTest/test-ex assertionTest(system.file(package="assertionTest", "test-ex", "allbad.t")) ## End(Not run)