Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add `subdir` arg to `make_fix_file` #33

Merged
merged 2 commits into from Mar 28, 2018

Conversation

Projects
None yet
2 participants
@BarkleyBG
Copy link
Contributor

commented Jan 26, 2018

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

Add `subdir` arg to `make_fix_file`
## 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
@krlmlr
Copy link
Member

left a comment

Thanks!

R/rrmake.R Outdated
@@ -5,8 +5,9 @@ make_find_root_file <- function(criterion) {
}))
}

make_fix_root_file <- function(criterion, path) {
make_fix_root_file <- function(criterion, path, subdir) {

This comment has been minimized.

Copy link
@krlmlr

krlmlr Jan 26, 2018

Member

subdir = NULL looks best to me, changing the test may mean breaking downstream code.

This comment has been minimized.

Copy link
@BarkleyBG

BarkleyBG Jan 26, 2018

Author Contributor

I can set subdir=NULL as default for make_fix_root_file().

Are there any other functions that rely on make_fix_root_file() whose behaviors might be altered?

I'd like to set up a unit test, but the formatting of the current unit tests is a little bit beyond my understanding

make_fix_root_file arg subdir default is NULL
This should make change to pass the existing unit tests
@codecov

This comment has been minimized.

Copy link

commented Jan 26, 2018

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%) ⬇️
R/criterion.R 97.95% <66.66%> (-2.05%) ⬇️

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

This comment has been minimized.

Copy link
Member

commented Jan 26, 2018

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

This comment has been minimized.

Copy link

commented on e8d3037 Mar 25, 2018

Sorry, missed that. subdir = NULL sounds like a good default for this internal function, because the cases where it's something else are rare.

@krlmlr krlmlr merged commit 6eb0e60 into r-lib:master Mar 28, 2018

2 of 4 checks passed

codecov/patch 50% of diff hit (target 86.97%)
Details
codecov/project 86.15% (-0.83%) compared to 851d293
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@krlmlr

This comment has been minimized.

Copy link
Member

commented Mar 28, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.