If you are adding this it would be good to either add or review existing implementation that checks the comparison is within a tolerance. This would be for asserting double values are close but not necessarily exact. I would rather we didn't get double comparison going through this method you describe which would be easy to do. Thanks mike On Tuesday, July 7, 2009, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Yes! May be one day we will arrive to use packages published in other places but right now critical elements should be in one project. Oscar if you see other good addition please push them too.
Stef
PS: I do not why I can open MC repositories but I cannot publish there.
On Jul 7, 2009, at 6:56 PM, Oscar Nierstrasz wrote:
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/Â <http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project>