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
Merged

Add subdir arg to make_fix_file #33

merged 2 commits into from Mar 28, 2018

Conversation

@BarkleyBG
Copy link
Contributor

@BarkleyBG BarkleyBG 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

## 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
Copy link
Member

@krlmlr krlmlr left a comment

Thanks!

Loading

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) {
Copy link
Member

@krlmlr krlmlr Jan 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Loading

Copy link
Contributor Author

@BarkleyBG BarkleyBG Jan 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Loading

This should make change to pass the existing unit tests
@codecov
Copy link

@codecov codecov bot 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.

Loading

@krlmlr
Copy link
Member

@krlmlr krlmlr 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.

Loading

@krlmlr krlmlr merged commit 6eb0e60 into r-lib:master Mar 28, 2018
2 of 4 checks passed
Loading
@krlmlr
Copy link
Member

@krlmlr krlmlr commented Mar 28, 2018

Thanks!

Loading

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants