Hi, Dave,

> From: dave / thomases.com [mailto:dave / thomases.com]
> Sent: Thursday, June 15, 2000 1:18 PM

> >   if $DEBUG
> >     # code to perform test
> >   end
> 
> Absolutely. (We should say that $DEBUG is set to true by the -d
> command line option).

Ah, I should say so...  Thank you.

% ruby -d myscript.rb

But bear in mind that some standard or RAA libraries are not '-d' aware...
They do not break processing your program but might show debug print
which is embedded by the its author.  Try it.

% grep \$DEBUG $RUBY_LIB


> Let me float an idea...
> 
> Say you want to include RubyUnit test code in your library's
> source. Rather than using 'if $DEBUG' or similar, is there any
> advantage to doing something like:
> 
>   =begin RubyUnit
> 
>      <tests>
> 
>   =end RubyUnit

Agree.

I think that redistributable libraries (applications, too?) should
have its self-testing code.  Using a standardized testing method
like RubyUnit (by Suketa-san) or testsupp (by \cle) rather than using
'if $DEBUG' much helps automatic self-testing because those testing
method not only invokes methods but also checks those results.


1. Embedding syntax...

  =begin test RubyUnit (other additional information like its version)
  =end

  =begin test testsupp
  =end

How about it?


2. Self-testing execution...

> and then having something that extracted and ran these
> 
>   ruby ru myfile.rb

Could it be acceptable?  Matz?

// NaHi