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

Implement expect_without_warnings() and friends #1690

Merged
merged 13 commits into from
Sep 27, 2022
Merged

Conversation

hadley
Copy link
Member

@hadley hadley commented Sep 22, 2022

Fixes #1679

I've kept the interface deliberately very minimum; let me know if you think there's anything I'm missing.

Copy link
Member

@lionel- lionel- left a comment

Choose a reason for hiding this comment

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

I'm having doubts about this. It looks like we're encouraging testing strings generated in other packages. Should we encourage snapshots instead?

NAMESPACE Outdated
@@ -124,6 +124,10 @@ export(expect_type)
export(expect_vector)
export(expect_visible)
export(expect_warning)
export(expect_without_condition)
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 these names are a bit too long. They will dominate the line width, making it harder to read the actual logic.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you have any ideas for alternatives? I don't particularly like expect_no_warnings() because expect_no_warnings(foo(), class = "abc") doesn't make as much sense to me.

Copy link
Member

Choose a reason for hiding this comment

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

Might be too literary but:

expect_sans_warnings(foo(), class = "foo")?

Copy link
Member Author

Choose a reason for hiding this comment

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

Or too French 😛

Copy link
Member

Choose a reason for hiding this comment

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

expect_no_warnings(foo(), class = "abc") doesn't make as much sense to me.

I don't love the "no" particle but I like the concision.
Does it make sense to read it as "expect no warnings of class 'abc'"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, you've convinced me

R/expect-no-condition.R Outdated Show resolved Hide resolved
R/expect-no-condition.R Outdated Show resolved Hide resolved
R/expect-no-condition.R Outdated Show resolved Hide resolved
Copy link
Member

@jennybc jennybc left a comment

Choose a reason for hiding this comment

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

I'm happy with this. I made a few inline proposals and comments. I also test drove it in a couple of packages where I had the sort of DIY test helper that this is meant to replace and all seems well (not a big surprise).

NEWS.md Outdated Show resolved Hide resolved
R/expect-condition.R Outdated Show resolved Hide resolved
R/expect-condition.R Outdated Show resolved Hide resolved
R/expect-no-condition.R Outdated Show resolved Hide resolved
R/expect-no-condition.R Outdated Show resolved Hide resolved
R/expect-no-condition.R Outdated Show resolved Hide resolved
hadley and others added 7 commits September 26, 2022 09:46
@hadley
Copy link
Member Author

hadley commented Sep 26, 2022

I marked these as experimental, which makes me feel better about including them in a patch release.

@hadley hadley mentioned this pull request Sep 26, 2022
24 tasks
@hadley hadley merged commit 24a6b53 into main Sep 27, 2022
@hadley hadley deleted the without-condition branch September 27, 2022 16:06
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.

expect_without_warning()
3 participants