Closed aseemk closed 11 years ago
Tossing out a few other ideas...
For strict equality (currently equal
):
actual.should.be(expected);
actual.should.be.exactly(expected)
For deep equality (currently eql
);
result.should.match(template);
result.should.mirror(template);
result.should.duplicate(template);
I still like be
best for strict equality, though exactly
is a nice alias I may add for times where you just want to be extra explicit. ;)
I like match
and mirror
equally, so if you feel overloading match
isn't a great idea, I can just stick with mirror
. I like both because their connotations are both nice and explicit.
I agree - equal
and eql
are too similar, and their meaning is not immediately clear.
I'm thinking of adding these aliases into my fork to improve readability for equality:
I'm thinking of doing this because it's not obvious at a glance at all the distinction between
equal
vseql
, and also because should'sequal
(strict) is different than the native assert'sequal
(loose).I kept
be
as strict equal since, at least to me, strict equality is way more useful, esp. in test code, than loose equality. The result is that bothbe()
andmatch()
are nice semantic names. =)What do you think? I feel like this improves the already-rocking should grammar.
Cheers, Aseem
P.S. Overloading
be()
will be a lot harder thanmatch()
so I might not be able to implementbe()
just yet. Implementing issue #9 though may help here.