Permalink
Browse files

Upgrade to latest version of testthat

  • Loading branch information...
1 parent f64767c commit 4e2152abfda3ef970a043b4204fb00ba0ed03c06 @hadley hadley committed Aug 25, 2010
View
@@ -11,6 +11,7 @@ Description: stringr is a set of simple wrappers that make R's string
appropriately, and the output data structures from each function
matches the input data structures of other functions.
Imports: plyr
+Suggests: testthat (>= 0.3)
License: GPL-2
Collate: 'c.r' 'checks.r' 'detect.r' 'dup.r' 'extract.r' 'length.r'
'locate.r' 'match.r' 'modifiers.r' 'pad-trim.r' 'replace.r'
View
@@ -1,25 +1,22 @@
-library(testthat)
-library_if_available(stringr)
-
context("String and pattern checks")
test_that("string is atomic", {
- expect_that(stringr:::check_string(list()),
+ expect_that(check_string(list()),
throws_error("must be an atomic"))
})
test_that("pattern is a string", {
- expect_that(stringr:::check_pattern(1),
+ expect_that(check_pattern(1),
throws_error("must be a character vector"))
})
test_that("error when string and pattern lengths incompatible", {
- expect_that(stringr:::check_pattern(letters, "a"), equals(letters))
- expect_that(stringr:::check_pattern("a", letters), equals("a"))
+ expect_that(check_pattern(letters, "a"), equals(letters))
+ expect_that(check_pattern("a", letters), equals("a"))
- expect_that(stringr:::check_pattern(c("a", "b", "c"), c("a", "b")),
+ expect_that(check_pattern(c("a", "b", "c"), c("a", "b")),
throws_error("not compatible"))
- expect_that(stringr:::check_pattern(c("a", "b"), c("a", "b", "c")),
+ expect_that(check_pattern(c("a", "b"), c("a", "b", "c")),
throws_error("not compatible"))
})
View
@@ -1,6 +1,3 @@
-library(testthat)
-library_if_available(stringr)
-
context("Detecting patterns")
test_that("special cases are correct", {
View
@@ -1,6 +1,3 @@
-library(testthat)
-library_if_available(stringr)
-
context("Duplicating strings")
test_that("basic duplication works", {
@@ -1,6 +1,3 @@
-library(testthat)
-library_if_available(stringr)
-
context("Extract patterns")
test_that("single pattern extracted correctly", {
View
@@ -1,6 +1,3 @@
-library(testthat)
-library_if_available(stringr)
-
context("Joining strings")
test_that("basic case works", {
View
@@ -1,6 +1,3 @@
-library(testthat)
-library_if_available(stringr)
-
context("String length")
test_that("length of missing string is missing", {
View
@@ -1,6 +1,3 @@
-library(testthat)
-library_if_available(stringr)
-
context("Locations")
test_that("basic location matching works", {
View
@@ -1,6 +1,3 @@
-library(testthat)
-library_if_available(stringr)
-
context("Matching groups")
set.seed(1410)
View
@@ -1,6 +1,3 @@
-library(testthat)
-library_if_available(stringr)
-
context("Test padding")
test_that("long strings are unchanged", {
View
@@ -1,6 +1,3 @@
-library(testthat)
-library_if_available(stringr)
-
context("Splitting strings")
test_that("special cases are correct", {
View
@@ -1,6 +1,3 @@
-library(testthat)
-library_if_available(stringr)
-
context("Extracting substrings")
alphabet <- str_c(letters, collapse = "")
View
@@ -1,6 +1,3 @@
-library(testthat)
-library_if_available(stringr)
-
context("Trimming strings")
test_that("trimming removes spaces", {
View
@@ -1,5 +1,4 @@
library(testthat)
library(stringr)
-library(plyr)
-test_dir(system.file("tests", package = "stringr"), StopReporter)
+test_package("stringr")

0 comments on commit 4e2152a

Please sign in to comment.