assertEquals(real, expected) or...
Moderator: General Moderators
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
assertEquals(real, expected) or...
I personally use the former, but I can't remember which is "right".
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Well, by default the error string is "%s." In the code, the call is passed to an assert method which receives an expectation object and a comparison. Sprintf() is passed the results from a method of the expectation class called overlayMessage(). In turn, testMessage() is called for the expectation class. From assert() on forward, the $second argument has been renamed $compare.
The reason why I asked if you were talking more of the error is that value is what will be printed when it fails.
The reason why I asked if you were talking more of the error is that value is what will be printed when it fails.
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Hi.
Actually I think it's me that has it "wrong". SUnit lists expected value first, and that is the fount of all XUnit tools. I went for the more naturally spoken "assert that real equals the expected".
It's interesting that the RSpec tool has as one of it's selling points that with their system you cannot get it wrong. Seems like it's a common problem.
Hopefully the parameter names will change in an upcoming version. I'll add it to my TODO.
yours, Marcus
Actually I think it's me that has it "wrong". SUnit lists expected value first, and that is the fount of all XUnit tools. I went for the more naturally spoken "assert that real equals the expected".
It's interesting that the RSpec tool has as one of it's selling points that with their system you cannot get it wrong. Seems like it's a common problem.
Hopefully the parameter names will change in an upcoming version. I'll add it to my TODO.
yours, Marcus