Apparently http://squeaksource.com/Testing/ already contains such a method, but sticks to the java convention. Regardless of which is better, it would be a bad idea to introduce an identically named method which reverse the argument order, so I suggest we stick to the implementation in the repository. !TestCase methodsFor: 'accessing' stamp: 'dc 4/2/2007 18:38'! assert: expected equals: actual ^ self assert: (expected = actual) description: (self comparingStringBetween: expected and: actual) ! ! !TestCase methodsFor: 'private' stamp: 'dc 4/2/2007 18:46'! comparingStringBetween: expected and: actual ^ String streamContents: [:stream | stream nextPutAll: 'Expected '; nextPutAll: (expected printStringLimitedTo: 10); nextPutAll: ' but was '; nextPutAll: (actual printStringLimitedTo: 10); nextPutAll: '.' ]! ! I would really like these methods in Pharo. dc is Damien Cassou, so this is license clean, I guess. Shall I publish just these methods to PharoInbox? - on On 7 Jul 2009, at 18:44, Oscar Nierstrasz wrote:
OK, have posted issue 939 and will post the change shortly ...
http://code.google.com/p/pharo/issues/detail?id=939
TestCase>>assert: actual equals: expected actual = expected ifFalse: [self signalFailure: 'Assertion failed. Expected: ' , expected printString , '; got: ' , actual printString]
Is it better to send asString or printString?
- on
On 7 Jul 2009, at 17:11, Stéphane Ducasse wrote:
please go ahead. I thought we got assert:equals:
Somebody should also have a look at SUnitExtensions one of these days.
On Jul 7, 2009, at 3:58 PM, Oscar Nierstrasz wrote:
Hi Folks,
I seem to recall that we added TestCase>>assert:eauals: to SUnit, but now I cannot find it.
It would be really useful to get decent error messages from equality tests (instead of "test failed", we would get "expected X but got Y").
Does anyone know what the story is?
If it exists somewhere, I would like to add it to Pharo.
If it doesn't exist anywhere, I would like to add it to Pharo.
- on
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project