>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. >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 [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
>>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? You can download the wiki or plain text of any Pier site like this: http://book.seaside.st/book/foreword?view=Wiki http://book.seaside.st/book/foreword?view=Text Lukas -- Lukas Renggli www.lukas-renggli.ch _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Torsten Bergmann
On Fri, May 7, 2010 at 1:25 AM, Torsten Bergmann <[hidden email]> wrote: >In addition to the story around tests, 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
_______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Torsten Bergmann
>> testAbsoluteAuthority
>> "self debug: #testAbsoluteAuthority" >> >> <test: #URI about: 'absolute uri with authority' tag: #(network )> >> >> | uri absoluteURIString | >> "An absolute URI with authority. An absolute URI starts with a scheme:" >> absoluteURIString := 'http://www.pharo-project.org'. >> uri := URI fromString: absoluteURIString. >> self assert: (uri asString = absoluteURIString). >> self assert: (uri isAbsolute). >> self assert: (uri authority asString = 'www.pharo-project.org'). >> self deny: (uri isOpaque). -> create an entry in the HelpSystem URI |> class comment of URI |> absolute uri with authority V testAbsoluteAuthority "self debug: #testAbsoluteAuthority" <test: #URI about: 'absolute uri with authority' tag: #(network )> | uri absoluteURIString | "An absolute URI with authority. An absolute URI starts with a scheme:" absoluteURIString := 'http://www.pharo-project.org'. uri := URI fromString: absoluteURIString. self assert: (uri asString = absoluteURIString). self assert: (uri isAbsolute). self assert: (uri authority asString = 'www.pharo-project.org'). self deny: (uri isOpaque). |> If there is a another test tagged with URI it should show up below But may be we could do that based on setting because everything is there. Stef _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by laurent laffont
Yes in fact we do not really need the helpSystem for that since Setting offer all the necessary behavior.
But let us give a try. the KEY POINT is use and improve tests => get executable and always in sync documentation => get better tests because if I know that my tests are used for documentation I will spend time on them. On May 7, 2010, at 1:59 PM, laurent laffont wrote: > > On Fri, May 7, 2010 at 1:25 AM, Torsten Bergmann <[hidden email]> 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 > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |