Skip to content
This repository has been archived by the owner on Feb 22, 2021. It is now read-only.

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinFay committed Feb 9, 2020
1 parent 2f5bb09 commit 189c108
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/testthat.R
@@ -0,0 +1,4 @@
library(testthat)
library(odds)

test_check("odds")
59 changes: 59 additions & 0 deletions tests/testthat/test-load.R
@@ -0,0 +1,59 @@
test_that("package works", {
st <- Storage$new(path = tempdir())
expect_is(
st,
"Storage"
)
expect_is(
st,
"R6"
)
nsp <- paste0(
sample(letters, 24),
collapse = ""
)
st$set("pouet", nsp)

res <- st$get(nsp)
expect_equal(
res,
"pouet"
)
expect_is(
res,
"character"
)

st$rm(nsp)

expect_error(
st$get(nsp)
)

nsp <- paste0(
sample(letters, 24),
collapse = ""
)

st$set(iris, "pouet", nsp)
res <- st$get("pouet", nsp)
expect_equal(
res,
iris
)
expect_is(
res,
"data.frame"
)

st$rm("pouet", nsp)

st$remove_namespace(
"global"
)

expect_error(
st$get("pouet")
)

})

0 comments on commit 189c108

Please sign in to comment.