TheSeamau5 / elm-check

Property Based Testing in Elm
70 stars 20 forks source link

Suggestion: sync order of expected/actual with failure messages #14

Closed rtfeldman closed 9 years ago

rtfeldman commented 9 years ago

Check.Test.test currently takes actual and then expected, in that order.

However, if you get a failure, the output will of course list "Expected: " followed by "got:"

It would be nice if Expected consistently came first, both in argument order and in error message. The alternative is having to remember on a case-by-case basis which comes first for which part of the API.

TheSeamau5 commented 9 years ago

I'm a bit conflicted on this one. Thing is I've made Check.Test to mirror the regular Check module which does actual then expected whereas elm-test does it the other way round. The reason I chose this order is cuz with the DSL it reads nicer

claim
  "Some claim"
  `that`
    actualStatement
  `is`
    expectedStatement
  `for`
    someInvestigator

So, in a sense, I'm worried that as soon as I do this, someone would be confused as to why the order is not the same in both modules.

I may also be worried about nothing. How confusing is this? Can I instead offer a DSL or additional functions to sweeten this?

rtfeldman commented 9 years ago

That reasoning makes sense. :smiley:

It's honestly not a huge deal to me one way or the other, as personally I'm using partial application to pre-populate the run count and seed, and I just flip the arguments while I'm at it...just thought I'd bring it up in case the ordering had been chosen arbitrarily and there was only an upside to changing it.