Hi everyone,

supposing that I want to keep code and tests in one single file, is there a common idiom to do that?

At the moment I'm going with something like:

 if $?FILE == $*PROGRAM_NAME {
  use Test;
  plan 1;
  ok foo();
 }

but this seem unnecessarily verbose.

Is there some standard idiom or function in Test.pm that allows this kind of thing with a nicer interface?

I think it should be possible and nice to use a macro (possibly a standard subroutine, I'm not sure) like

testing {
 ok foo;
}

would it make sense or I'm just crazy?

Reply via email to