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 code to test test_that calls. #83

Merged
merged 2 commits into from
Jul 19, 2013
Merged

Conversation

craigcitro
Copy link
Contributor

I wanted to make test-xxx.r actually testable, which was complicated by the fact that test_that is designed not to return anything. The natural fit seemed to be to pass in a reporter that did my bidding, which is what I've done. I think the result is that test_test_that works fairly reasonably, but if you think it's gotten too fancy for its own good, that's okay, too.

(Note that this branch is based on the other testing branch, so the code will look repetitive -- only the last diff is new. Is there a way to tell github to only show the relative changes? I'll clean this up once the other pull request is in.)

if (result$passed) return()
new_failure <- list()
new_failure[[test]] = result
failures <<- c(failures, new_failure)
Copy link
Member

Choose a reason for hiding this comment

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

I think those three lines are equivalent to failures[[test]] <<- new_failure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

touche. (originally there was a browser() call before the last line while debugging ...)

@hadley
Copy link
Member

hadley commented Jul 18, 2013

Looking good. Can you rebase (once I've merged the other pull request) and squash? (And add a similar bullet to NEWS)

Currently, `dir_state` can fail in unfortuate ways when a file disappears
between reading a directory listing and calculating a hash of its contents;
this patch fixes the problem by catching the failure and returning NA.
This change adds a new reporter that simply gathers expectation failures
silently, and rewrites `inst/tests/test-xxx.r` to use it.
@craigcitro
Copy link
Contributor Author

This is ready to go modulo merging the other pull request -- it's based on that one, so presumably it "just works" once the first is merged.

There was a little excitement on my side when I accidentally used rebase --onto -- I think everything's fine now.

hadley added a commit that referenced this pull request Jul 19, 2013
Add code to test test_that calls.
@hadley hadley merged commit a074ffc into r-lib:master Jul 19, 2013
@hadley
Copy link
Member

hadley commented Jul 19, 2013

Thanks again for all this work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants