Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travisci #1

Merged
merged 8 commits into from
Jun 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
language: r
cache: packages
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Description: This package contains functions that build off of the core
building blocks in testwhat. Often, these will be multiple simple
SCTs combined.
Imports: testwhat
Suggests: testthat
Remotes: datacamp/testwhat
License: MIT + file LICENSE
LazyData: TRUE
RoxygenNote: 5.0.1
1 change: 1 addition & 0 deletions R/examples.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ check_object2 <- function(state, names) {
#' @param state state to start from
#' @param name passed to check_function
#' @param index passed to check_function
#' @param args an array of argument names, passed to check_args, then check_equal.
#' @importFrom testwhat check_function check_arg check_equal %>%
#'
#' @export
Expand Down
2 changes: 2 additions & 0 deletions man/check_function2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions man/hello.Rd

This file was deleted.

10 changes: 5 additions & 5 deletions tests/testthat/helper-setup_state.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
setup_state <- function(stu_code, sol_code, PEC = "", output = "") {
if (is.character(output)) output <- list(type = "output", payload = output)
if (is.character(output)) output <- list(list(type = "output", payload = output))

tw <<- testwhat:::tw

sol_env <- new.env()
stu_env <- new.env()

evaluate::evaluate(PEC, envir=sol_env)
evaluate::evaluate(sol_code, envir=sol_env)
evaluate::evaluate(PEC, envir=stu_env)
evaluate::evaluate(stu_code, envir=stu_env)
eval(parse(text = PEC), envir=sol_env)
eval(parse(text = sol_code), envir=sol_env)
eval(parse(text = PEC), envir=stu_env)
eval(parse(text = stu_code), envir=stu_env)

tw$clear()

Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test_examples.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
context("Examples")

test_that("state is setup correctly", {
state <- setup_state("x <- 1", "x <- 1", output = "a b c")
state %>% testwhat::check_output("a b c")
})

test_that("check_object2 passes", {
state <- setup_state("x <- 1; y <- 2", "x <- 1; y <- 2")
state %>% check_object2(c('x', 'y'))
Expand Down