hadley/test_that — Issue #28: Encoding issues in sys.source() 
Author: haven-jeon
Created: 2012-01-02 06:34:54+00:00
State: open

I've got error when I run testthat in Windows.

* checking for unstated dependencies in examples ... OK
* checking examples ... NONE
* checking for unstated dependencies in tests ... OK
* checking tests ...
Running 'test-all.R'
ERROR
Running the tests in 'tests/test-all.R' failed.
Last 13 lines of output:
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(testthat)
> library(KoNLP)
Loading required package: rJava
Loading required package: bitops
> test_package("KoNLP")
Error in parse(n = -1, file = file) :
invalid multibyte character in parser at line 5
Calls: test_package ... with_reporter -> force -> lapply -> FUN -> sys.source
-> parse
Execution halted

I was using UTF-8 test case source to check Korean NLP functions, Linux(UTF-8) or Mac was ok. but Windows was not.

I think, Usages of sys.source in testthat need to be sys.source(file(",,,,,", encoding=""), env).

Freely check with my package on "https://github.com/haven-jeon/KoNLP".