Just some prove tricks I thought I'd pass along.

Parse TAP from a file, rather than program output.  Handy for doing
experiments without having to mock up a program.

    $ cat ~/tmp/foo.tap
    1..2
    ok 1
    ok 2

    $ prove --exec 'cat' ~/tmp/foo.tap
    /Users/schwern/tmp/foo....ok
    All tests successful.
    Files=1, Tests=2,  0 wallclock secs ( 0.04 usr +  0.01 sys =  0.05 CPU)
    Result: PASS

Make prove run tests as executables with no interpreter.  Useful for mixed
language environments and tests written in compiled C.  Just make sure your
tests have the executable bit set and that you're using an unambiguous path to
the test (ie. not "test.t" but "./test.t") so prove doesn't search your $PATH.

  $ ls -l
  total 12K
  -rwxrwxr-x 1 schwern schwern 53 2009-02-25 17:30 test.perl
  -rwxrwxr-x 1 schwern schwern 53 2009-02-25 17:31 test.ruby
  -rwxrwxr-x 1 schwern schwern 42 2009-02-25 17:31 test.sh
  $ prove --exec '' t/test.*
  t/test.perl....ok
  t/test.ruby....ok
  t/test.sh......ok
  All tests successful.
  Files=3, Tests=6,  0 wallclock secs ( 0.04 usr  0.02 sys +  0.00 cusr  0.01
csys =  0.07 CPU)
  Result: PASS

Here's a kind of crappy way to make TAP read from STDIN.

  $ prove --exec 'cat -' test.dummy
  test....

Now you can write TAP and finish with ctrl-d.  But test.dummy has to exist.


-- 
ROCKS FALL! EVERYONE DIES!
        http://www.somethingpositive.net/sp05032002.shtml

Reply via email to