Skip to content

Commit

Permalink
Use namespace for private function
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Aug 24, 2010
1 parent 2d8c55c commit 41e25e8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions inst/tests/test-check.r
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ library_if_available(stringr)
context("String and pattern checks")

test_that("string is atomic", {
expect_that(check_string(list()), throws_error("must be an atomic"))
expect_that(stringr:::check_string(list()),
throws_error("must be an atomic"))
})

test_that("pattern is a string", {
expect_that(check_pattern(1), throws_error("must be a character vector"))
expect_that(stringr:::check_pattern(1),
throws_error("must be a character vector"))
})

test_that("error when string and pattern lengths incompatible", {
expect_that(check_pattern(letters, "a"), equals(letters))
expect_that(check_pattern("a", letters), equals("a"))
expect_that(stringr:::check_pattern(letters, "a"), equals(letters))
expect_that(stringr:::check_pattern("a", letters), equals("a"))

expect_that(check_pattern(c("a", "b", "c"), c("a", "b")),
expect_that(stringr:::check_pattern(c("a", "b", "c"), c("a", "b")),
throws_error("not compatible"))
expect_that(check_pattern(c("a", "b"), c("a", "b", "c")),
expect_that(stringr:::check_pattern(c("a", "b"), c("a", "b", "c")),
throws_error("not compatible"))
})

0 comments on commit 41e25e8

Please sign in to comment.