whatyouhide / stream_data

Data generation and property-based testing for Elixir. 🔮
https://hexdocs.pm/stream_data
866 stars 67 forks source link

Remove inconsistency in gen all and check_all #37

Closed josevalim closed 7 years ago

josevalim commented 7 years ago

It is a bit awkward to see those functions side by side when it comes to their name inconsistencies. One option is to move the gen function back to the PropertyTest module since right now it relies exclusively on public APIs.

whatyouhide commented 7 years ago

Good point on the inconsistency. However, gen all is quite useful to build complex generators and generators are not meant to be used in property testing only so I am not sure that moving it out of StreamData is a good idea.

josevalim commented 7 years ago

@whatyouhide we can always find a way to add them back to StreamData if necessary later.

I guess one of the related questions is how we are going to bring generators into the test code too.

whatyouhide commented 7 years ago

@josevalim right now property "foo" do end imports StreamData inside its body and that's how we use generators when writing properties, but this does not work well for defining generators outside of properties (which I would say it's a pretty common thing to do).

josevalim commented 7 years ago

@whatyouhide right. that's why i was thinking that if you want property tests you should do use ExUnit.Properties (to mirror ExUnit.Assertions) and that would import gen+check all as well all generators and the property/2 macro.

whatyouhide commented 7 years ago

Sounds great to me. @josevalim wdyt of 1. renaming PropertyTest to ExUnitProperties, and 2. move gen all to there?

josevalim commented 7 years ago

@whatyouhide yes. We should probably get a :+1: from @ericmj and @lexmag in the name as well.

lexmag commented 7 years ago

ExUnit.Properties seems very intuitive name to me. 👍