Dear all,
I’m struggling with a unit test where I try to use the SqlRender package. A minimal reproducible example would be
test_that( "a test", { sql <- SqlRender::loadRenderTranslateSql("test.sql", dbms="sql server", packageName="SomePackageName") })
I’ve put a file named test.sql containing nothing in inst/sql/sql_server and built the package, and when I run devtools::test() there are two warnings followed by a error message:
file("") only supports open = “w+” and open = “w+b”: using the former
text connection used with readChar(), results may be incorrect
invalid ‘nchars’ argument
It believe it’s the nchars argument in the line “readChar(pathToSql, file.info(pathToSql)$size)” that causes the error. If the test is run line-by-line in my console, everything works fine.
I found the same error message on Eunomias website, but it could be totally unrelated I guess: https://ohdsi.github.io/Eunomia/reference/createCohorts.html
I’ve also posted this on SqlRenders github page, and will link to the answer if it’s answered there first.