check_via_read: check via reading files

View source: R/utils.R

check_via_readR Documentation

check via reading files

Description

check whether a writen correct file is equivalent to a writen one produced by strcode

Usage

check_via_read(directory = "test-dir_in",
  filename = "code_summary-example-1", path_start)

Arguments

directory

A path relative to "tests/testthat"

filename

The name of a file to check. The name of the file to check against is filename_correct

path_start

A string specifiing the location of of testthat relative to the project root. See details

Details

When testing is performed manually (that is, not via test routine of RStudio), reading in files needs a directory relative to the project main directory. When running tests via RStudio, the directory must be indicated relative to the testthat folder. Hence, for manual testing, we need a different path than for routine testing. The problem can be solved by assigning a global variable to path_start manually plus setting path_start to NULL at the beginning of the document, so when the tests are run via the RStudio routine, they are set correctly.


lorenzwalthert/strcode documentation built on May 11, 2023, 12:10 a.m.