Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update r.tskel example template set

  • Loading branch information...
commit b0f8541cd02d9b01998bf3597339bbddc9fd3380 1 parent bcc92cb
@tomtom authored
View
4 .gitignore
@@ -6,5 +6,5 @@ TODO_archived.viki
*.vmb
*.zip
.last_*
-test
-test_*
+test/
+test_*/
View
6 templator/r.tskel/_init.R
@@ -1,7 +1,7 @@
# project.dir <- normalizePath(dirname(parent.frame(2)$ofile))
project.dir <- normalizePath(dirname((function() {attr(body(sys.function()), "srcfile")})()$filename))
-source(paste(project.dir, "lib/variables.R", sep = "/"))
-source(paste(project.dir, "lib/functions.R", sep = "/"))
-source(paste(project.dir, "lib/db.R", sep = "/"))
+source(file.path(project.dir, "lib/variables.R"))
+source(file.path(project.dir, "lib/functions.R"))
+source(file.path(project.dir, "lib/db.R"))
View
18 templator/r.tskel/test.${1=main}.R
@@ -0,0 +1,18 @@
+source("_init.R")
+
+<+if(get(b:templator_args, "runit", 0))+>
+library("RUnit")
+
+test.<+call:get(b:templator_args, "1", "main")+>.suite <- defineTestSuite("<+call:get(b:templator_args, "1", "main")+>",
+ dirs = file.path("tests"),
+ testFileRegexp = '^test_<+call:get(b:templator_args, "1", "main")+>(_.*?)?\\.R$')
+
+test.<+call:get(b:templator_args, "1", "main")+>.result <- runTestSuite(test.<+call:get(b:templator_args, "1", "main")+>.suite)
+
+printTextProtocol(test.<+call:get(b:templator_args, "1", "main")+>.result)
+<+else+>
+library("testthat")
+
+test_dir("tests", reporter = "Summary")
+<+endif+>
+
View
13 templator/r.tskel/tests/test_${1=main}.R
@@ -0,0 +1,13 @@
+<+if(get(b:templator_args, "runit", 0))+>
+test.<+call:get(b:templator_args, "1", "main")+> <- function() {
+ <+CURSOR+>
+}
+<+else+>
+test_that("<+call:get(b:templator_args, "1", "main")+>", {
+ # expect_that(observed, expected)
+
+ <+CURSOR+>
+
+})
+<+endif+>
+
View
14 templator/r.txt
@@ -0,0 +1,14 @@
+r template set
+
+This template set serves as an example for how to use templator.
+
+Run with:
+
+ :Templator [*][PATH/]r [NAME] [runit=1]
+
+The first argument is a name that defaults to "main". The name is used
+in several locations in the template files.
+
+If runit is true, the runit library is used for testing. If not, the
+testthat library is used.
+

0 comments on commit b0f8541

Please sign in to comment.
Something went wrong with that request. Please try again.