Skip to content

Commit

Permalink
Merge pull request #40 from ateucher/master
Browse files Browse the repository at this point in the history
subset animals on windows for when by='random'
  • Loading branch information
sckott committed Oct 15, 2015
2 parents e1e9468 + 9642555 commit 942eef2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions R/get_who.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ get_who <- function(by, length) {
if (.Platform$OS.type == "windows") {
ua <- c('shortcat','longcat','fish','signbunny','stretchycat',
'anxiouscat','longtailcat','grumpycat','mushroom')

if (by %in% ua) {
stop("If you're on Windows, you can't use:\n",
paste0(sort(ua), collapse = "\n"), call. = FALSE)
}

animals <- animals[setdiff(names(animals), ua)]
}

by <- match.arg(by, c(choices = names(animals), "rms", "random"))
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-say.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ test_that("say by works as expected", {
test_that("say fails well", {
expect_error(say(list(4, 5)), "what has to be of length 1")
})

test_that("say fails with certain characters on windows", {
skip_on_os(c("mac", "linux", "solaris"))
expect_error(say("Hi", by = "longcat"), "If you're on Windows, you can't use")
})

0 comments on commit 942eef2

Please sign in to comment.