[R-sig-Debian] running unit tests on the stringr package

kamaraju kusumanchi raju.mailinglists at gmail.com
Sun Apr 19 23:58:53 CEST 2015


I am trying to learn how  to run the unit tests in the stringr package
and have the following questions.

1) The r-cran-stringr package does not suggest/depend on the
r-cran-testthat package . Would it make sense to add such a thing
since after all the tests in /usr/lib/R/site-library/stringr/tests
rely on testthat package?

2) I am getting the following error when trying to run the unit tests

% R
R version 3.1.1 (2014-07-10) -- "Sock it to Me"
...
> library('testthat')
> library('stringr')
> test_dir('/usr/lib/R/site-library/stringr/tests')
String and pattern checks : 123
Counting matches : ....
Detecting patterns : ..........
Duplicating strings : ......
Extract patterns : ..
Joining strings : ......
String length : .........
Locations : ............
Matching groups : ..............
Test padding : ....
Splitting strings : .........................
Extracting substrings : ...................
Trimming strings : ........


1. Failure(@test-check.r#4): string is atomic ----------------------------------
check_string(list()) does not match 'must be an atomic'. Actual value:
"Error in force(expr) : could not find function "check_string"\n"

2. Failure(@test-check.r#9): pattern is a string -------------------------------
check_pattern(1) does not match 'must be a character vector'. Actual
value: "Error in force(expr) : could not find function
"check_pattern"\n"

3. Error: error when string and pattern lengths incompatible -------------------
could not find function "check_pattern"
1: withCallingHandlers(eval(code, new_test_environment), error = capture_calls)
2: eval(code, new_test_environment)
3: eval(expr, envir, enclos)
4: expect_that(check_pattern(letters, "a"), equals(letters)) at test-check.r:14
5: condition(object)
6: compare(expected, actual, ...)
7: compare.character(expected, actual, ...)
8: identical(x, y)

What am I doing wrong?

I am using a Debian box with a combo of Wheezy + Jessie

% dpkg -l r-cran-testthat r-cran-stringr r-base
ii  r-base                     3.1.1-1            all
GNU R statistical computation and graphics system
ii  r-cran-stringr             0.6.2-2            all
Make it easier to work with strings
ii  r-cran-testthat            0.9.1-1            amd64
GNU R testsuite

regards
raju
-- 
Kamaraju S Kusumanchi | http://raju.shoutwiki.com/wiki/Blog



More information about the R-SIG-Debian mailing list