Skip to content

A few inverted expectiations#305

Merged
hadley merged 7 commits into
r-lib:masterfrom
krlmlr:303-neg
Oct 12, 2015
Merged

A few inverted expectiations#305
hadley merged 7 commits into
r-lib:masterfrom
krlmlr:303-neg

Conversation

@krlmlr
Copy link
Copy Markdown
Member

@krlmlr krlmlr commented Oct 3, 2015

  • expect_success() -- if failure should not abort the test
  • expect_less_than_or_equal() and expect_more_than_or_equal()

With tests. Modeled as "new-style" expectations, the arguments of the _or_equal variants differ.

Also adds expect_silent() to the "expectations" family.

expect_unnamed() seems unnecessary, as expect_named() can already test for absence of names.

@hadley: Do you want to export expect() at some point?

Fixes #303.

Comment thread R/expectations-success.R Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think you accidentally included this line

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch. I was wondering if this function necessary at all, we already have expect_error(..., NA)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, that's a good point.

@krlmlr
Copy link
Copy Markdown
Member Author

krlmlr commented Oct 6, 2015

Removed expect_success().

Another option would be to support an optional argument: expect_less_than(..., allow_equal = FALSE). This would be more in spirit of the other functions: expect_named(..., NULL), expect_error(..., NA), expect_warning(..., NA), ...

@hadley
Copy link
Copy Markdown
Member

hadley commented Oct 7, 2015

I'd also feel better if they were named expect_lt, expect_lte etc. The current names are a bit verbose.

@krlmlr
Copy link
Copy Markdown
Member Author

krlmlr commented Oct 8, 2015

Added shorter versions: lt, lte, mt, mte

@hadley
Copy link
Copy Markdown
Member

hadley commented Oct 8, 2015

I think gt (greater than) is the more common abbreviation

@krlmlr
Copy link
Copy Markdown
Member Author

krlmlr commented Oct 9, 2015

Now using gt.

hadley added a commit that referenced this pull request Oct 12, 2015
A few inverted expectiations
@hadley hadley merged commit 8d32664 into r-lib:master Oct 12, 2015
@hadley
Copy link
Copy Markdown
Member

hadley commented Oct 12, 2015

Thanks!

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