Prevent an empty AssetProxy macro from causing an infinite loop. Fixes bug #12046. Thanks to Trex for the patch!

This commit is contained in:
Colin Kuskie 2011-02-14 17:49:47 -08:00
parent 6865fda6e1
commit 90dec24634
3 changed files with 20 additions and 12 deletions

View file

@ -14,24 +14,22 @@ use lib "$FindBin::Bin/../lib";
use WebGUI::Test;
use WebGUI::Session;
use HTML::TokeParser;
use WebGUI::Asset;
use Test::More; # increment this value for each test you create
my $session = WebGUI::Test->session;
my $numTests = 0;
plan tests => 2;
$numTests += 1; #For the use_ok
use WebGUI::Macro::AssetProxy;
plan tests => $numTests;
$session->asset(WebGUI::Asset->getDefault($session));
my $macro = 'WebGUI::Macro::AssetProxy';
my $loaded = use_ok($macro);
SKIP: {
skip "Unable to load $macro", $numTests-1 unless $loaded;
}
my $output;
$output = WebGUI::Macro::AssetProxy::process($session);
is $output, undef, 'calling AssetProxy with no identifier returns no error message in normal mode';
$session->var->switchAdminOn;
$output = WebGUI::Macro::AssetProxy::process($session);
like $output, qr/Invalid Asset URL/, '..., adminOn, return error message';