tests/testthat/test-sanitize_R_version.R

context("sanitize_R_version")

test_that("Version strings are valid", {
  expect_error(sanitize_R_version("3"))
  expect_error(sanitize_R_version("3>=3.5.0"))
  expect_error(sanitize_R_version("3 b.0"))
})

test_that("Version strings are actually sanitized", {
  expect_equal(sanitize_R_version(" >= 5 .4 2.  0", clean=TRUE), "5.42.0")
  expect_equal(sanitize_R_version(">= 3. 5  "), ">=3.5.0")
})

test_that("Minimum required version is checked", {
  expect_error(sanitize_R_version(">=2.14"))
  expect_equal(sanitize_R_version(">=2.14", R_version_min=NULL), ">=2.14.0")
})

Try the RInno package in your browser

Any scripts or data that you put into this service are public.

RInno documentation built on May 1, 2019, 10:52 p.m.