File: test-extract.r

package info (click to toggle)
r-cran-stringr 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 304 kB
  • sloc: makefile: 3
file content (14 lines) | stat: -rw-r--r-- 355 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
context("Extract patterns")

test_that("single pattern extracted correctly", {
  test <- c("one two three", "a b c")
  
  expect_that(
    str_extract_all(test, "[a-z]+"),
    equals(list(c("one", "two", "three"), c("a", "b", "c"))))
  
  expect_that(
    str_extract_all(test, "[a-z]{3,}"),
    equals(list(c("one", "two", "three"), character())))
  
})