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

eventually + assertMatch #162

Open
NeQuissimus opened this issue May 2, 2018 · 3 comments
Open

eventually + assertMatch #162

NeQuissimus opened this issue May 2, 2018 · 3 comments

Comments

@NeQuissimus
Copy link

Using a combination of eventually and assertMatch is currently rather inconvenient.
assertMatch returns Unit while eventually expects Boolean.

So the following piece of code does not compile

  eventually {
        assertMatch(y) {
          case Success(x: String) if x == "bla" =>
        }
      }

while this does but only with a manual true as a workaround.

  eventually {
      assertMatch(y) {
        case Success(x: String) if x == "bla" =>
      }
      true
    }

Maybe an eventually that only cares about match errors or a new eventuallyMatch could be added?

@frgomes
Copy link

frgomes commented May 4, 2018

In my opinion, the following should be plenty enough:

eventually {
  assert(condition)
  true
}

No need for assertThis, assertThat, assertWhatever. No need for eventuallyThis, eventuallyThat, eventuallyWhatever. If you seek the convenience of such this that whatever, you should employ ScalaTest instead, not uTest.

@NeQuissimus
Copy link
Author

@frgomes Thanks for the friendly contribution. My point is that I don't think it should be necessary to add a manual true after the assert. I would have expected my first code snippet to compile.

@frgomes
Copy link

frgomes commented May 4, 2018

@NeQuissimus :: I certainly understand your point. My point is that uTest should not be polluted with this, that, whatever just because API X has a certain function or syntax construct which happens to not look nice or convenient. You may have a myriad of circumstances where something may not look nice or convenient and, if we extend uTest everytime something does not look nice or convenient, uTest will soon look like ScalaTest.

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