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

and combinator behaves differently for MatchResult and Result under MustThrowExpectations #1255

Closed
kneisslm opened this issue Jul 4, 2024 · 1 comment

Comments

@kneisslm
Copy link

kneisslm commented Jul 4, 2024

Environment: Specs 2 4.20.5, Scala 2.12

See example below. I'd expect that both examples fail. In practice only the first (eg1) fails.

Specification

import org.specs2.Specification
import org.specs2.execute.Result
import org.specs2.matcher.MustThrownExpectations

class ResultAndSpecification extends Specification with MustThrownExpectations {

  def is = {
    s2"""
Combining MatchResult and Result should behave like combining MatchResult with MatchResult in MustThrownExpectations.

I'd expect that both examples fail.

  - two MatchResults $eg1
  - MatchResult and Result $eg2
"""
  }


  def eg1 = {
    (ok and ko)

    ok
  }

  def eg2 = {
    ok and (ko: Result)

    ok
  }
}

Output

[info] ResultAndSpecification
[info] Combining MatchResult and Result should behave like combining MatchResult with MatchResult in MustThrownExpectations.
[info] I'd expect that both examples fail.
[error]   x two MatchResults
[error]  ko (ResultAndSpecification.scala:26)
[info]   + MatchResult and Result
[info] Total for specification ResultAndSpecification
[info] Finished in 28 ms
[info] 2 examples, 1 failure, 0 error
@etorreborre
Copy link
Owner

Thanks for reporting this issue @kneisslm. It is fixed in 4.20.8.

This issue was closed.
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

No branches or pull requests

2 participants