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

A few inverted expectiations #305

Merged
merged 7 commits into from Oct 12, 2015
Merged

A few inverted expectiations #305

merged 7 commits into from Oct 12, 2015

Conversation

krlmlr
Copy link
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.

#' }
expect_success <- function(expr) {
label <- find_expr("expr")
out <- evaluate_promise(expr)
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 you accidentally included this line

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

krlmlr commented Oct 8, 2015

Added shorter versions: lt, lte, mt, mte

@hadley
Copy link
Member

hadley commented Oct 8, 2015

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

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

None yet

2 participants