Move Macro utility module into t/lib
Break Macro.t into component tests resolve conflicts from merge prove passes on t/Macro
This commit is contained in:
parent
83d59837fd
commit
bf960218bf
9 changed files with 24 additions and 172 deletions
|
|
@ -16,7 +16,7 @@ use WebGUI::Test;
|
|||
use WebGUI::Macro;
|
||||
use WebGUI::Session;
|
||||
use Data::Dumper;
|
||||
use Macro_Config;
|
||||
use WebGUI::Macro_Config;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use WebGUI::Test;
|
|||
use WebGUI::Macro;
|
||||
use WebGUI::Session;
|
||||
use Data::Dumper;
|
||||
use Macro_Config;
|
||||
use WebGUI::Macro_Config;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,17 +9,17 @@
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
# ---- BEGIN DO NOT EDIT ----
|
||||
use FindBin;
|
||||
use strict;
|
||||
use lib '../../lib';
|
||||
use Getopt::Long;
|
||||
use lib "$FindBin::Bin/../lib";
|
||||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Macro_Config;
|
||||
use Data::Dumper;
|
||||
use Macro_Config;
|
||||
# ---- END DO NOT EDIT ----
|
||||
|
||||
my $session = initialize(); # this line is required
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
|
||||
my $macroText = '^D("%s",%s);';
|
||||
|
|
@ -43,6 +43,8 @@ plan tests => $numTests;
|
|||
|
||||
diag("Planning on running $numTests tests\n");
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
unless ($session->config->get('macros')->{'D'}) {
|
||||
diag("Inserting macro into config");
|
||||
Macro_Config::insert_macro($session, 'D', 'Date');
|
||||
|
|
@ -54,23 +56,3 @@ foreach my $testSet (@testSets) {
|
|||
WebGUI::Macro::process($session, \$output);
|
||||
is($output, $testSet->{output}, 'testing '.$testSet->{format});
|
||||
}
|
||||
|
||||
cleanup($session); # this line is required
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE -----
|
||||
|
||||
sub initialize {
|
||||
$|=1; # disable output buffering
|
||||
my $configFile;
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile
|
||||
);
|
||||
exit 1 unless ($configFile);
|
||||
my $session = WebGUI::Session->open("../..",$configFile);
|
||||
}
|
||||
|
||||
sub cleanup {
|
||||
my $session = shift;
|
||||
$session->close();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use WebGUI::Test;
|
|||
use WebGUI::Macro;
|
||||
use WebGUI::Session;
|
||||
use Data::Dumper;
|
||||
use Macro_Config;
|
||||
use WebGUI::Macro_Config;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
package Macro_Config;
|
||||
|
||||
sub insert_macro {
|
||||
my ($session, $nickname, $macroName) = @_;
|
||||
my %macros = $session->config->get('macros');
|
||||
$macros{$nickname} = $macroName;
|
||||
$session->config->{_config}->set(macros => \%macros);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
@ -8,20 +8,20 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
# ---- BEGIN DO NOT EDIT ----
|
||||
use FindBin;
|
||||
use strict;
|
||||
use lib '../../lib';
|
||||
use Getopt::Long;
|
||||
use lib "$FindBin::Bin/../lib";
|
||||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Macro_Config;
|
||||
use Data::Dumper;
|
||||
use Macro_Config;
|
||||
# ---- END DO NOT EDIT ----
|
||||
|
||||
my $session = initialize(); # this line is required
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
unless ($session->config->get('macros')->{'Quote'}) {
|
||||
diag("Inserting macro into config");
|
||||
Macro_Config::insert_macro($session, 'Quote', 'Quote');
|
||||
|
|
@ -58,23 +58,3 @@ foreach my $testSet (@testSets) {
|
|||
WebGUI::Macro::process($session, \$output);
|
||||
is($output, $testSet->{output}, 'testing '.$testSet->{input});
|
||||
}
|
||||
|
||||
cleanup($session); # this line is required
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE -----
|
||||
|
||||
sub initialize {
|
||||
$|=1; # disable output buffering
|
||||
my $configFile;
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile
|
||||
);
|
||||
exit 1 unless ($configFile);
|
||||
my $session = WebGUI::Session->open("../..",$configFile);
|
||||
}
|
||||
|
||||
sub cleanup {
|
||||
my $session = shift;
|
||||
$session->close();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use WebGUI::Test;
|
|||
use WebGUI::Macro;
|
||||
use WebGUI::Session;
|
||||
use Data::Dumper;
|
||||
use Macro_Config;
|
||||
use WebGUI::Macro_Config;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue