Skip to content

Commit

Permalink
test for addCommand -- fixes #12
Browse files Browse the repository at this point in the history
  • Loading branch information
wwbrannon committed Dec 28, 2016
1 parent 96ad42a commit 91dd307
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/testthat/test-add_command.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
context("User-defined commands")

test_that("Adding user commands works", {
nsenv <- getNamespace('ado')
pkgenv <- as.environment('package:ado')

cmd <- function(expression) { return(as.character(expression)) }

expect_false('testprint' %in% ls(envir=nsenv))

ado(string='addCommand cmd, newname(testprint)')

expect_true('ado_cmd_testprint' %in% ls(envir=nsenv &&
'ado_cmd_testprint' %not_in% ls(envir=pkgenv)))
})

0 comments on commit 91dd307

Please sign in to comment.