Hi all,
I have been working with JS for quite a while, but coming from a .Net
background. I was wondering if it is possible to do something like
this in JavaScript:
var expected = 5;
var result = sut.somemethod(param1);
result.shouldEqual(expected);
Now, the key thing is that I'd like to have an extension on any object
be it string, Integer or regular object to internally call one of the
QUnit methods (in this case equal(result, expected);
I have been playing with something like: Object.prototype.shouldEqual
= function(expected){
equal(this, expected);
}
But this (obviously) does not work. Is there a way to get this kind of
syntax sugar?
KR,
Tom
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]