Cisco-Reconfig

 view release on metacpan or  search on metacpan

t/banner.t  view on Meta::CPAN

#!/usr/bin/perl -I. -w

use Cisco::Reconfig;
use Test;
use Carp qw(verbose);
use Scalar::Util qw(weaken);

use strict;

my $debugdump = 0;

if ($debugdump) {
	$Cisco::Reconfig::nonext = 1;
}

BEGIN { plan test => 6 };

sub wok
{
	my ($a, $b) = @_;
	require File::Slurp;
	import File::Slurp;
	write_file('x', $a);
	write_file('y', $b);
	return ok($a,$b);
}

my $config = readconfig(\*DATA);

if ($debugdump) {
	require File::Slurp;
	require Data::Dumper;
	import File::Slurp;
	import Data::Dumper;
	$Data::Dumper::Sortkeys = 1;
	$Data::Dumper::Sortkeys = 1;
	$Data::Dumper::Terse = 1;
	$Data::Dumper::Terse = 1;
	$Data::Dumper::Indent = 1;
	$Data::Dumper::Indent = 1;
	write_file("dumped", Dumper($config));
	exit(0);
}

ok(defined $config);

# -----------------------------------------------------------------
{

my $x = $config->get('banner motd');
#undef $config;
#use Data::Dumper;
#print Dumper($x);
#exit(0);
ok($x->subs->text, <<END);
 
                Company XXXX
 
Unauthorized use of this system is forbidden. Anyone's activities here may
be
monitored at any time; if monitoring yields evidence of criminal, unethical,
or unauthorized activity, University and/or law enforcement officials will
be
informed.  Note that in this process authorized activity may also be
revealed.
 



( run in 1.179 second using v1.01-cache-2.11-cpan-9789f410c06 )