My test.R file:
context("The context")
test_that('should pass',function(){
expect_equal(42,42)
})
test_that('should fail',function(){
expect_equal(43,42)
})
test_that('should error',function(){
stop()
})
When I write analogous tests using Runit:
test.should_pass <- function(){
checkEquals(42,42)
}
test.should_fail <- function(){
checkEquals(43,42)
}
test.should_error <- function(){
stop()
}
I get the output:
> results <- runTestFile('tests.r')
Executing test function test.should_error ... Timing stopped at: 0 0 0
Error in func() :
done successfully.
Executing test function test.should_fail ... Timing stopped at: 0 0 0.001
Error in checkEquals(43, 42) : Mean relative difference: 0.02325581
done successfully.
Executing test function test.should_pass ... done successfully.
> results
Number of test functions: 3
Number of errors: 1
Number of failures: 1