tests/testthat/test_hello.R

library(hellodev)
testthat::context("hello message")

testthat::test_that("hello message correctly given",{

  testthat::expect_equal(hello("Anne"),"Hello Anne")
  testthat::expect_equal(hello("Jane", call = TRUE),"Hello Jane")
  testthat::expect_equal(hello("Jane", call = FALSE), "Hello world!")

})

testthat::test_that("custom message correctly given",{

  testthat::expect_error(customMessage("Anne"))
  testthat::expect_equal(customMessage("Anne","Nice to see you"),"Nice to see you Anne")
  testthat::expect_equal(customMessage("Anne","Nice to see you", call =TRUE),"Nice to see you Anne")
  testthat::expect_equal(customMessage("Anne","Nice to see you", call =FALSE),"Nice to see you")
})
dinithi/hellodev documentation built on May 15, 2019, 8:46 a.m.