#!/usr/bin/perl use warnings; use strict; use Test::More tests => 5; ok( require( 'myScript' ), 'loaded file okay' ) or exit; throws_ok { main( ) } qr/Usage:/, 'main( ) should give a usage error without any arguments'; throws_ok { main( 'bad command' ) } qr/Unknown command 'bad command'/, '... or with a bad command given';