diff --git a/example_projects/example_project1/tests/testthat/testArithmetics.R b/example_projects/example_project1/tests/testthat/testArithmetics.R index 1e36b87..de8d7c5 100644 --- a/example_projects/example_project1/tests/testthat/testArithmetics.R +++ b/example_projects/example_project1/tests/testthat/testArithmetics.R @@ -30,7 +30,7 @@ test("Test with no points", c(), { expect_equal(1,1) }) -test("Dummy test set to fail", c("r1.7"), { +test("Dummy test set to fail", c(), { expect_true(FALSE) expect_equal(1,2) }) diff --git a/example_projects/example_project1/tmc/result.R b/example_projects/example_project1/tmc/result.R index 9d9e386..e436591 100644 --- a/example_projects/example_project1/tmc/result.R +++ b/example_projects/example_project1/tmc/result.R @@ -1,4 +1,4 @@ -library('testthat') +llibrary('testthat') library('jsonlite') #declaring variables to global environment that for example helperTMC.R can use diff --git a/tmcRtestrunner/.Rbuildignore b/tmcRtestrunner/.Rbuildignore new file mode 100644 index 0000000..91114bf --- /dev/null +++ b/tmcRtestrunner/.Rbuildignore @@ -0,0 +1,2 @@ +^.*\.Rproj$ +^\.Rproj\.user$ diff --git a/tmcRtestrunner/DESCRIPTION b/tmcRtestrunner/DESCRIPTION new file mode 100644 index 0000000..03fb59d --- /dev/null +++ b/tmcRtestrunner/DESCRIPTION @@ -0,0 +1,13 @@ +Package: tmcRtestrunner +Type: Package +Title: What the Package Does (Title Case) +Version: 0.1.0 +Author: Who wrote it +Maintainer: The package maintainer +Description: More about what it does (maybe more than one line) + Use four spaces when indenting paragraphs within the Description. +License: What license is it under? +Encoding: UTF-8 +LazyData: true +Depends: + testthat diff --git a/tmcRtestrunner/NAMESPACE b/tmcRtestrunner/NAMESPACE new file mode 100644 index 0000000..8b7afee --- /dev/null +++ b/tmcRtestrunner/NAMESPACE @@ -0,0 +1,3 @@ +exportPattern("^[[:alpha:]]+") + +import(testthat) diff --git a/tmcRtestrunner/R/RunTests.R b/tmcRtestrunner/R/RunTests.R new file mode 100644 index 0000000..aa0615a --- /dev/null +++ b/tmcRtestrunner/R/RunTests.R @@ -0,0 +1,20 @@ + +runTests <- function(project_path, print = FALSE) { + # Runs the tests from project directory and writes results JSON to the root of the project + # as .tmc_results.json. + # + # Args: + # project_path: The path to the root of the project being tested. + # print: If TRUE, prints results; if not, not. DEFAULT is FALSE. + # + + +} + +.hidden_function <- function() { +} + +DummyFunction <- function() { + # A dumy function for testthat testing (before real tests) + return(TRUE) +} diff --git a/tmcRtestrunner/man/hello.Rd b/tmcRtestrunner/man/hello.Rd new file mode 100644 index 0000000..8b7e601 --- /dev/null +++ b/tmcRtestrunner/man/hello.Rd @@ -0,0 +1,12 @@ +\name{hello} +\alias{hello} +\title{Hello, World!} +\usage{ +hello() +} +\description{ +Prints 'Hello, world!'. +} +\examples{ + +} diff --git a/tmcRtestrunner/tests/testthat.R b/tmcRtestrunner/tests/testthat.R new file mode 100644 index 0000000..b8df590 --- /dev/null +++ b/tmcRtestrunner/tests/testthat.R @@ -0,0 +1,4 @@ +library(testthat) +library(tmcRtestrunner) + +test_check("tmcRtestrunner") diff --git a/tmcRtestrunner/tests/testthat/testRunTests.R b/tmcRtestrunner/tests/testthat/testRunTests.R new file mode 100644 index 0000000..f6fb738 --- /dev/null +++ b/tmcRtestrunner/tests/testthat/testRunTests.R @@ -0,0 +1,3 @@ +test_that("Dummy test before real tests.", { + expect_true(DummyFunction()) +}) diff --git a/tmcRtestrunner/tmcRtestrunner.Rproj b/tmcRtestrunner/tmcRtestrunner.Rproj new file mode 100644 index 0000000..497f8bf --- /dev/null +++ b/tmcRtestrunner/tmcRtestrunner.Rproj @@ -0,0 +1,20 @@ +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source