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

Conversation

Projects
None yet
2 participants
@krlmlr
Member

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)

This comment has been minimized.

@hadley

hadley Oct 6, 2015

Member

I think you accidentally included this line

This comment has been minimized.

@krlmlr

krlmlr Oct 6, 2015

Member

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

This comment has been minimized.

@hadley

hadley Oct 6, 2015

Member

Yeah, that's a good point.

Kirill Müller added some commits Oct 3, 2015

@krlmlr

This comment has been minimized.

Member

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

This comment has been minimized.

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.

Kirill Müller
@krlmlr

This comment has been minimized.

Member

krlmlr commented Oct 8, 2015

Added shorter versions: lt, lte, mt, mte

Kirill Müller
@hadley

This comment has been minimized.

Member

hadley commented Oct 8, 2015

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

Kirill Müller
@krlmlr

This comment has been minimized.

Member

krlmlr commented Oct 9, 2015

Now using gt.

hadley added a commit that referenced this pull request Oct 12, 2015

Merge pull request #305 from krlmlr/303-neg
A few inverted expectiations

@hadley hadley merged commit 8d32664 into r-lib:master Oct 12, 2015

2 checks passed

continuous-integration/appveyor AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@hadley

This comment has been minimized.

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