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

Add tests for all derived instances #516

Merged
merged 29 commits into from
Sep 13, 2022
Merged

Conversation

joroKr21
Copy link
Member

@joroKr21 joroKr21 commented Sep 13, 2022

Unfortunately there is some code duplication because I didn't find a way to make this generic.
But the boilerplate is minimal because we just wrap existing ADTs into a sort of newtype case class.

Closes #425 by making sure it works for all type classes

@joroKr21 joroKr21 marked this pull request as draft September 13, 2022 03:35
@mergify mergify bot added the core label Sep 13, 2022
@joroKr21 joroKr21 marked this pull request as ready for review September 13, 2022 10:22
@joroKr21 joroKr21 self-assigned this Sep 13, 2022
@joroKr21 joroKr21 changed the title Add tests for derived instances Add tests for all derived instances Sep 13, 2022
Copy link
Member

@TimWSpence TimWSpence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome! Thanks so much!!

case LeafI(i) => Right(i)
}

enum EnumK1[A]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this meant to be Covariant?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it doesn't matter

import scala.quoted.*

/** An opinionated stack of traits to improve consistency and reduce boilerplate in Kittens tests. Note that unlike the
* corresponding CatsSuite in the Cat project, this trait does not mix in any instances.
*/
abstract class KittensSuite extends KittensSuite.WithoutEq, TestEqInstances
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these instances used for? I thought we were defining explicit instances for everything in ADTS?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the EqInstances separately to be able to test Eq without interference 🐔 🥚

import org.scalacheck.{Arbitrary, Cogen, Gen}
import scala.annotation.tailrec

object ADTs:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So are we dropping testing for sealed traits in favour of enums? I had assumed that we would test both (although that sucks 😂 )

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not dropping anything 🤔 - we just add more tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh so we are! 🤦

@joroKr21 joroKr21 merged commit 0abf568 into typelevel:master Sep 13, 2022
@joroKr21 joroKr21 deleted the enum-tests branch September 13, 2022 18:06
@gvolpe
Copy link
Member

gvolpe commented Sep 13, 2022

Thank you for all this work 😍 ! New milestone coming out soon?

@TimWSpence
Copy link
Member

Thank you for all this work 😍 ! New milestone coming out soon?

We're aiming for at least an RC if not full release ASAP :)

@joroKr21 joroKr21 restored the enum-tests branch September 14, 2022 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Scala 3] - Wildcard derivation import not working
3 participants