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

ZIO Test: Add new spec type #4518

Closed
jdegoes opened this issue Dec 23, 2020 · 5 comments
Closed

ZIO Test: Add new spec type #4518

jdegoes opened this issue Dec 23, 2020 · 5 comments

Comments

@jdegoes
Copy link
Member

jdegoes commented Dec 23, 2020

To provide a more "flat" style and without any commas, it would be nice to define a mutable spec, supporting the following syntax:

object MySpec extends MutableRunnableSpec {
  suite("foo") {
    testM("name") {
    } @@ ignore

    test("name 2") {
      suite("another suite") {
      }
    }
  }
}

This would be accomplished by defining suite and test and testM methods directly inside MutableRunnableSpec, which would mutably append to a data structure, which would be materialized when the def spec of the parent runnable spec is called.

In order to support annotations, the test and suite methods would have to return some object with @@ side-effect method, which modifies in-place the last definition by applying the test aspect.

The goal would be to preserve the existing ZIO Test syntax and feature set almost exactly, while at the same time getting away from the "comma" syntax which many find annoying.

@fokot
Copy link
Contributor

fokot commented Dec 23, 2020

I will take this

@hmemcpy
Copy link
Contributor

hmemcpy commented Jan 16, 2021

Thanks so much for this! I'll add support for it in the IntelliJ plugin and it will make my teammates happy 👍

One question: can top-level tests be added without suite?

@jdegoes
Copy link
Member Author

jdegoes commented Jan 16, 2021

Yes, no need for top-level suites. By default there is a top-level suite that has the same name as the spec object.

@hmemcpy
Copy link
Contributor

hmemcpy commented Jan 16, 2021

Excellent! Thank you!

@hmemcpy
Copy link
Contributor

hmemcpy commented Jan 16, 2021

Also I think this issue can be 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

3 participants