On Tuesday 19 October 2004 03:19 pm, Florian Gross wrote:
| gabriele renzi wrote:
| > Mauricio Fernández ha scritto:
| >> Look carefully at the example:
| >>
| >>     #   # This creates a Regexp which will match 3 "foo"s.
| >>     #   re = Regexp::English.literal("foo" * 3)
| >>     #   re.match("foofoofoo")[0] # => "foofoofoo"
| >
| > sidenote: I'd prefer to see this done like:
| > # This creates a Regexp which will match 3 "foo"s.
| > # irbprompt>somecode
| > # =>someresult
| > # irbprompt>somemore
| > # =>someother
|
| I think the latter is harder to read, because there is more clutter,
| though in theory that style could also be supported by test-extract.
|
| Maybe I can add it later if there is enough demand for it.

Actually goes with your '# outputs ...' notation if you use '# => ...' 
instead. 

  # This creates a Regexp which will match 3 "foo"s.
  # irbprompt>somecode # =>someresult
  # irbprompt>somemore # =>someother

And I see no good reason to keep the irb prompt so...

  # This creates a Regexp which will match 3 "foo"s.
  # somecode # =>someresult
  # somemore # =>someother

Fairly simple transformation from irb.

T.