Stéphane Ducasse a écrit :
On Mar 31, 2010, at 5:38 PM, Hilaire Fernandes wrote:

I wrote two tests on the ArrayTest collection to test #sorted and #sorted:
#sorted broke, it is easy to fix.

I guess we need to write these tests for the whole CollectionTest hierarchy.  I 
noted there is a CollectionRootTest using trait, however when looking at the 
asSortedCollection tests, it is reapeatly written for almost each classes of 
the hierarchy, and not in the CollectionRootTest using inheritance mechanism.
Any reason for that?

Hilaire you should read the paper on traits.

pointer on *one* good tutorial? I think I already read something. A small memento on the syntax to define and to use trait will be enough to get started comfortably. If there are such a things I suggest we add it in good place in the pharo web site (along a paper on unit test); these features are essential parts -- features -- of Pharo, so why not emphasis it.

Btw, it would be a nice idea to convert an html version of the Pharo by example book, so we can have direct pointer to chapter from the pharo web site. It should be doable with latex2html. In the past I used hyperlatex to produce both nice html and pdf version of DrGeo manual (http://documentation.ofset.org/drgeo/fr/drgenius_51.html)


Probably sorted does not make sense on all collection so we define a trait and 
apply it when needed.

Yes. What about writing like bellow? Is it acceptable or is it cumbersome?


testSorted
 self unsortedCollection ifNotNil: [self assert: ....]


Matrix>>unosrtedCollection
 ^ nil

Arary>>unosrtedCollection
 ^ #(5 9 1 3 2)


Traits are simple, just have a look. I did a presentation at esug about them.



_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to