atExpectWarnings(expr, expected = ".")
expr | An expression to evaluate. It will be taken literally, as in system.time(). |
expected | Regular expressions that should match the expected warning messages. See regexpr for the syntax. "." means to match any warning. |
## Not run: # First two examples should return TRUE atExpectWarnings({ warning("Comparing integer and complex number") 1L == (1+0i)}, expected = "integer.*complex") atExpectWarnings( atExpectStop({warning("Hmm, possible problem") stop("Oops")}, expected="Oops"), expected = "Hmm")# Next one should describe lack of expected warning atExpectWarnings(all(is.finite(log(3:4))), "NaNs produced")
# Run example test files in assertionTest/test-ex assertionTest(system.file(package="assertionTest", "test-ex", "mixed.t", mustWork=TRUE)) ## End(Not run)