On Fri, May 7, 2010 at 1:25 AM, Torsten Bergmann <astares@gmx.de> wrote:
In addition to the story around tests,
Could you be a little bit more specific what your wishes are for using tests within the help documentation? It's still not clear to me what you expect here.
Hi Torsten, IIRC this idea came from a discussion I had with Stef. There's some tests that show "how" to use the class it tests, that can make a good documentation for free. For example (may not be the best): XMLParserTest>>testParsing | xmlDocument root firstPerson numberOfPersons | xmlDocument := XMLDOMParser parseDocumentFrom: self addressBookXML readStream. self assert: (xmlDocument isKindOf: XMLDocument). root := xmlDocument root. self assert: (root class == XMLElement). "the tag has to be a symbol!" self assert: (root firstTagNamed: 'person') isNil. self assert: (root firstTagNamed: 'addressbook') isNil. self assert: (root firstTagNamed: #addressbook) == root. numberOfPersons := 0. root tagsNamed: #person do: [:p | numberOfPersons := numberOfPersons + 1]. self assert: numberOfPersons = 4. firstPerson := root firstTagNamed: #person. self assert: (firstPerson attributeAt: #'employee-number') = 'A0000'. self assert: (firstPerson attributeAt: #'family-name') = 'Gates'. self assert: (firstPerson attributeAt: #'first-name') = 'Bob'. Just reading it you know how to use XMLDOMParser. We don't need to add comments to understand it. So the idea is to tag this test to tell that we can learn from it. Then HelpSystem can built the documentation of XML-Parser package just by collecting the tests. Laurent Laffont
Torsten do you think we could use book.pharo-project.org to populate the help?
Dont know how the pier books are implemented. Is it possible to access/parse the contents either on the server or directly online from a client image?
If so then yes, as the following example demonstrates:
|topic day url sub| topic := HelpTopic named: 'Last week on Squeak IRC'. 0 to: 7 do: [:index | day := (Date today subtractDays: index) printFormat: #(3 2 1 $. 1 2 2). url := 'http://tunes.org/~nef/logs/squeak/' , day. sub := HelpTopic title: day contents: (HTTPLoader default retrieveContentsFor: url) contents. topic addSubtopic: sub. ]. HelpBrowser openOn: topic
Bye T.
-- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project