From 5e7c0faf688a807440f15621e7a85bc1391d08c2 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sat, 29 Jul 2006 23:38:32 +0000 Subject: [PATCH] During the rework of the Macro tests to only test the macro procedure instead of the macro processor, all tests which default behavior (no parameters) were broken. The next series of test commits will remedy this on all tests. Also during this time, each test will be augmented to abort the test if the Macro cannot be loaded. --- t/Macro/a_account.t | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/t/Macro/a_account.t b/t/Macro/a_account.t index 5380f7d64..ca59e22c4 100644 --- a/t/Macro/a_account.t +++ b/t/Macro/a_account.t @@ -13,7 +13,6 @@ use strict; use lib "$FindBin::Bin/../lib"; use WebGUI::Test; -use WebGUI::Macro::a_account; use WebGUI::Session; use HTML::TokeParser; use Data::Dumper; @@ -33,31 +32,31 @@ my $i18n = WebGUI::International->new($session,'Macro_a_account'); my @testSets = ( { + comment => 'linkonly argument', label => q!linkonly!, template => q!!, output => $session->url->append($homeAsset->getUrl(),'op=auth;method=init'), - comment => 'linkonly argument', }, { - label => $i18n->get(46), + comment => 'default macro call', + label => q!!, template => q!!, url => $session->url->page('op=auth;method=init'), ##already validated URL above output => \&simpleHTMLParser, - comment => 'default macro call', }, { + comment => 'custom label', label => q!This is your account!, template => q!!, url => $session->url->page('op=auth;method=init'), output => \&simpleHTMLParser, - comment => 'custom label', }, { + comment => 'custom template', label => q!Custom label!, template => $template->get('url'), url => $session->url->page('op=auth;method=init'), output => \&simpleTextParser, - comment => 'custom template', }, ); @@ -66,11 +65,14 @@ foreach my $testSet (@testSets) { $numTests += 1 + (ref $testSet->{output} eq 'CODE'); } -plan tests => $numTests; +plan tests => $numTests + 1; + +use_ok('WebGUI::Macro::a_account'); foreach my $testSet (@testSets) { my $output = WebGUI::Macro::a_account::process( $session, $testSet->{label}, $testSet->{template} ); + $testSet->{label} ||= $i18n->get(46); ##Get default text if blank if (ref $testSet->{output} eq 'CODE') { my ($url, $label) = $testSet->{output}->($output); is($label, $testSet->{label}, $testSet->{comment}.", label");