On Fri, Sep 16, 2016 at 2:45 AM, stepharo <steph...@free.fr> wrote:
Hi all

I want something similar in the spirit to PythonDocTest
https://docs.python.org/2/library/doctest.html

I'm talking about

basename
     "Returns the base of the basename,
         i.e.
         /foo/gloops.taz basename is 'gloops.taz'
         / basename is '/'"

Pragmas do not work well i.e.,
basename
     "Returns the base of the basename"
      <expr: '''/foo/gloops.taz'' asFileReference basename' result:
'gloops.taz'>


We should invent a syntax to be put inside comments and that we can easily
parse because we need to improve
the use and discovery of the library.

I was thinking about

basename
     "Returns the base of the basename"
     "
     '/foo/gloops.taz' asFileReference basename
     >>> 'gloops.taz'
     "

Do you have any idea?
basename
      "Returns the base of the basename"
      """
      '/foo/gloops.taz' asFileReference basename
         ==> 'gloops.taz'
      """
     self size == 0
     "the root node"
         ifTrue: [ ^ '/'].
      ^ self at: self size

I like this idea.  But a fine semantic....
We should think of these less as "tests"
and more as "howto" snippets that are tested for correctness.

They should show just the *simplest* was to get an object to which the
method can be sent.
Maybe they could be also displayed via the gtExample interface ??

May be. Right now I want to make sure that all the little examples that are written for example
inside methods are correct.

Stef

cheers -ben




Reply via email to