context("freeze")
# description object create
description = sessionInfo()$loadedOnly[[1]]
test_that("version and package name are extracted correctly", {
dscr = get_version_and_pkgname(description)
expect_is(dscr$Version, "character")
expect_is(dscr$Package, "character")
expect_match(dscr$Version, "\\.")
})
# actual freeze() tests ----------------------------------------------------------
reqs_filename = "requirements.yaml"
test_that("we're operating on the now created requirements, not old one", {
expect_false(file.exists(reqs_filename))
})
test_that("freeze creates the package list (requirements.csv) in our wd", {
freeze()
expect_error(read_yaml(reqs_filename), NA)
expect_true(file.exists(reqs_filename))
})
test_that("freeze creates correct columns", {
content = read_yaml(reqs_filename)
expect_is(content, "list")
expect_gt(length(content), 2) # TODO: arbitral test - for redesign
expect_match(content[[1]]$Version[1], "[0-9]\\.")
})
test_that("file is removed", {
file.remove(reqs_filename)
expect_false(file.exists(reqs_filename))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.