Test::Env - test the environment


Test-Env documentation Contained in the Test-Env distribution.

Index


Code Index:

NAME

Top

Test::Env - test the environment

SYNOPSIS

Top

	use Test::More tests => 1;
	use Test::Env;

	env_ok( 'PERL5LIB', "./blib/lib" );

DESCRIPTION

Top

Functions

env_ok( NAME, VALUE )

Ok if the environment variable NAME is VALUE.

SOURCE AVAILABILITY

Top

This source is part of a SourceForge project which always has the latest sources in CVS, as well as all of the previous releases.

	http://sourceforge.net/projects/brian-d-foy/

If, for some reason, I disappear from the world, one of the other members of the project can shepherd this module appropriately.

AUTHOR

Top

brian d foy, <bdfoy@cpan.org>

COPYRIGHT AND LICENSE

Top


Test-Env documentation Contained in the Test-Env distribution.
# $Id: Env.pm 2299 2007-08-13 02:47:06Z comdog $
package Test::Env;
use strict;

use base qw(Exporter);
use vars qw(@EXPORT $VERSION);

@EXPORT  = qw(env_ok);
$VERSION = 1.08;

use Test::Builder;

my $Test = Test::Builder->new();

sub env_ok($$)
	{
	my $name  = shift;
	my $value = shift;

	unless( exists $ENV{$name} )
		{
		$Test->ok(0);
		$Test->diag( "Environment variable [$name] missing!\n",
			"\tExpected [$value]\n" );
		}
	elsif( $ENV{$name} ne $value )
		{
		$Test->ok(0);
		$Test->diag( "Environment variable [$name] has wrong value!\n",
			"\tExpected [$value]\n",
			"\tGot [$ENV{$name}]\n" );
		}
	else
		{
		$Test->ok(1);
		}
	}


"Roscoe";