in reply to Re: How to export subs in a bin/script for testing in t/00.t
in thread How to export subs in a bin/script for testing in t/00.t
Oooh! Very cool!..
I wrapped the part of the main body that runs stuff into a sub run() and then I have a line such as (in bin/script).. (pseudocode follows..)
Then in t/00.t#!/usr/bin/perl caller() or run(); sub run { print do_stuff_1(); print do_stuff_2(); } sub do_stuff_1 { 1 } sub do_stuff_2 { 2 } 1;
Thank you! This is a wonderful solution. (Maybe someone has another (more elegant, less intrusive?) way to do this?)use Test::Simple 'no_plan'; require 'bin/script'; ok( do_stuff_1(), 'do_stuff_1()' );
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: How to export subs in a bin/script for testing in t/00.t
by bduggan (Pilgrim) on Feb 27, 2010 at 13:57 UTC | |
Re^3: How to export subs in a bin/script for testing in t/00.t
by Anonymous Monk on Feb 26, 2010 at 22:07 UTC |
In Section
Seekers of Perl Wisdom