r-lib / rprojroot

Finding files in project subdirectories
https://rprojroot.r-lib.org/
Other
149 stars 23 forks source link

Add `subdir` arg to `make_fix_file` #33

Closed BarkleyBG closed 6 years ago

BarkleyBG commented 6 years ago

Fixes #32

How it works

    > myTestHelperFun <- is_testthat$make_fix_file()
    > myTestHelperFun("foo.txt")
    [1] ".../rprojroot/tests/testthat/foo.txt"
    > myTestHelperFunTwo <- is_testthat$make_fix_file(subdir = "woot")
    > myTestHelperFunTwo("bar.txt")
    [1] ".../rprojroot/tests/testthat/woot/bar.txt"

Fails tests

  1. Error: Shortcuts (@test-make.R#7) ------------------------------------------- argument "subdir" is missing, with no default

So, either:

  1. change the test
  2. make subdir=NULL the default for make_fix_root_file()

What next

I'm not sure whether to change the default behavior or not, so I'll wait for response from @krlmlr

codecov[bot] commented 6 years ago

Codecov Report

Merging #33 into master will decrease coverage by 0.82%. The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #33      +/-   ##
==========================================
- Coverage   86.97%   86.15%   -0.83%     
==========================================
  Files           6        6              
  Lines         192      195       +3     
==========================================
+ Hits          167      168       +1     
- Misses         25       27       +2
Impacted Files Coverage Δ
R/rrmake.R 88.88% <0%> (-11.12%) :arrow_down:
R/criterion.R 97.95% <66.66%> (-2.05%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 851d293...2ed7425. Read the comment docs.

krlmlr commented 6 years ago

Thanks. I think test-make.R would be a good place to add a test. The tests there could use a bit of refactoring and perhaps comments, too. It's confusing because the make_...() functions return a function which then needs to be called.

krlmlr commented 6 years ago

Thanks!