4

誰かが私を助けて 、停止メッセージに追加されたexpect_that 場合になぜ機能しないのかを説明できますか。[]つまり、機能しますf1f2機能しません。

library(testthat)
f1 <- function(x){
  if(  x >= 1 ){
    stop("error 1")
  }
}
expect_that(f1(x=1.4), throws_error("error 1"))
f2 <- function(x){
  if(  x >= 1 ){
    stop("error [1]")
  }
}
expect_that(f2(x=1.4), throws_error("error [1]"))
4

1 に答える 1