-
Notifications
You must be signed in to change notification settings - Fork 35
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
Inline test files directly into tests #133
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those files seems be from ancient history before testthat where they lived in inst/tests
It seems way easier to maintain now.
Though, I don't know if you noticed, but they are using in examples in several places like this
Lines 8 to 14 in b2a2689
#' @examples | |
#' samples <- system.file("tests", "testthat", package = "evaluate") | |
#' if (file_test("-d", samples)) { | |
#' replay(evaluate(file(file.path(samples, "order.R")))) | |
#' replay(evaluate(file(file.path(samples, "plot.R")))) | |
#' replay(evaluate(file(file.path(samples, "data.R")))) | |
#' } |
through the replay
function.
So either they should be kept elsewhere, or those examples should be inlined, or even changed.
I think these are the only one used
tests/testthat/test-errors.R
Outdated
@@ -26,6 +32,12 @@ test_that("traceback useful if stop_on_error == 2L", { | |||
}) | |||
|
|||
test_that("capture messages in try() (#88)", { | |||
ev <- evaluate(file("try.R")) | |||
# TODO: figure out why this doesn't work interactively |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is not working for this exactly ? Out of curiosity I tried locally and it seemed to work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea 😬 I'll have to look again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah seems fine now so I'm not sure what the problem was.
tests/testthat/example-1.R
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this test is tested anymore. Historically, as the others, all those tests were before testthat
structure, and inside inst/tests
.
So probably not testing something we still need - I didn't find what interweave
was
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me neither! Maybe it's the original name of evaluate?
tests/testthat/order.R
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is used in examples:
Line 11 in b2a2689
#' replay(evaluate(file(file.path(samples, "order.R")))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks! I'll inline them into the examples too.
This makes it much easier to understand what the tests are actually doing.