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

Not detecting unused expression in zio-test specs? #249

Closed
zalbia opened this issue Mar 9, 2021 · 5 comments
Closed

Not detecting unused expression in zio-test specs? #249

zalbia opened this issue Mar 9, 2021 · 5 comments

Comments

@zalbia
Copy link

zalbia commented Mar 9, 2021

Expected behavior: Should detect unused expression, though I'm not sure if intended
Actual behavior: Unused expression not detected

Platform:

  • Windows 10 (2004)
  • Intellij 2020.3
  • zio-intellij 2020.3.5.1
  • Scala 2.13.5

Minimal reproduction:

import zio.test._

object Repro extends DefaultRunnableSpec {
  def spec = suite("Repro") {
    testM("foo") { ??? } // undetected unused expression
    testM("bar") { ??? }
  }
}
@hmemcpy
Copy link
Collaborator

hmemcpy commented Mar 9, 2021

Hmm. In the default spec, the suite expects a varargs list of tests, separated by commas. I don't think this would even compile, and intellij would definitely paint it all as red as a Christmas tree...
Not sure suite(...) { ... } even works (need to check), you have to place it in parentheses.

The new ZIO has a DefaultMutableRunnableSpec where you can place top-level test/testMs without separating them by commas.

Either way, let me see if I could detect such missing commas and offer to add them!

@zalbia
Copy link
Author

zalbia commented Mar 9, 2021

It compiles for me, here it is in Scastie. This boils down to my misuse of specs: Spec[R, E, T]*. Like you said, it should be parens instead of curly brackets. So what ends up happening is only the last test gets run, which in the Scastie is shown as the Fiber failing on line 6, but not on line 5.

@myazinn
Copy link
Collaborator

myazinn commented Mar 19, 2023

Closed here.
image

@myazinn myazinn closed this as completed Mar 19, 2023
@hmemcpy
Copy link
Collaborator

hmemcpy commented Mar 19, 2023

I think this might not be related. The + operator is for zio test in 2.0, the ZIO 1 tests needed to be comma-separated AFAIK

@myazinn
Copy link
Collaborator

myazinn commented Mar 19, 2023

@hmemcpy seems to work fine with ZIO 1.0.17 (haven't checked other lower versions)
image

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

3 participants