witchcrafters / type_class

(Semi-)principled type classes for Elixir
https://hex.pm/packages/type_class
MIT License
140 stars 16 forks source link

Property tests during compilation are getting in the way... #52

Open asmodehn opened 1 year ago

asmodehn commented 1 year ago

Hi everyone, here is some feedback...

After using type_class for a while, I reached the conclusion that running property tests during compilation doesn't match the "usual elixir developer" expectations. Well, at least mine, I'll let everyone else make their own mind about it while I attempt to make my case.

I see mainly two reasons:

What does everyone else think ?

Overall I find type_class very useful for structuring code, but I would prefer typeclass property tests to run with mix test. Especially because a codepath can jump through various protocol implementation in various files, having tests failing along the path would help... Maybe via a classtest macro, accepting the typeclass atom to test as parameter, that could be used with ExUnit just like doctest ?

asmodehn commented 1 year ago

I had a go at adding a macro to run property test for typeclass during mix test, you can find it there : https://github.com/asmodehn/type_class/pull/2/files

cognivore commented 1 year ago

In our fork we disabled proptests by default, but can run them on CI with an env flag!