On Tuesday, 8 May 2018 at 03:57:25 UTC, Johannes Loher wrote:
Fluent assertions have one major advantage over using pascalCase assertions: There is no ambiuguity about the order of arguments.

When using e.g. assertEquals, how do you know wheter is is supposed to be assertEquals(actual, expected), or assertEquals(expected, actual)? The first one is the only one that makes sense wirh UFCS, but it is not clear directly from the API. On top of that, some popular Frameworks (I‘m looking at you, JUnit...) do it exactly the other
way round.

With fluent assertions, you don‘t have this Problem, it is much more clear that it should be actual.should.equal(expected) and not expected.should.equal(actual), because it fits naturally in the chain of ufcs calls.

Okay, I think I see your point, although it looks to me the added verbosity and code complexity is not really worth it, provided you always use UFCS. But of course, that cannot be easily enforced I guess.
  • unit-threaded v0.7.4... Atila Neves via Digitalmars-d-announce
    • Re: unit-thread... Johannes Loher via Digitalmars-d-announce
      • Re: unit-th... Dechcaudron via Digitalmars-d-announce
        • Re: uni... Johannes Loher via Digitalmars-d-announce
          • Re:... Nick Sabalausky (Abscissa) via Digitalmars-d-announce
            • ... Cym13 via Digitalmars-d-announce
              • ... Nick Sabalausky (Abscissa) via Digitalmars-d-announce
                • ... Cym13 via Digitalmars-d-announce
                • ... bauss via Digitalmars-d-announce
            • ... Jacob Carlborg via Digitalmars-d-announce
          • Re:... Dechcaudron via Digitalmars-d-announce
      • Re: unit-th... bauss via Digitalmars-d-announce

Reply via email to