-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for SpectreTest macro. Handle fall-through condition in Macr…
…o itself.
- Loading branch information
1 parent
d535e74
commit ad67b8a
Showing
2 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#------------------------------------------------------------------- | ||
# WebGUI is Copyright 2001-2009 Plain Black Corporation. | ||
#------------------------------------------------------------------- | ||
# Please read the legal notices (docs/legal.txt) and the license | ||
# (docs/license.txt) that came with this distribution before using | ||
# this software. | ||
#------------------------------------------------------------------- | ||
# http://www.plainblack.com info@plainblack.com | ||
#------------------------------------------------------------------- | ||
|
||
use FindBin; | ||
use strict; | ||
use lib "$FindBin::Bin/../lib"; | ||
|
||
use WebGUI::Test; | ||
use WebGUI::Session; | ||
use WebGUI::Operation::Spectre; | ||
|
||
my $original_spectreCheck = \&WebGUI::Operation::Spectre::spectreTest; | ||
my $spectreStatus; | ||
*WebGUI::Operation::Spectre::spectreTest = sub { | ||
return $spectreStatus; | ||
}; | ||
|
||
use WebGUI::Macro::SpectreCheck; | ||
|
||
use Test::More; # increment this value for each test you create | ||
|
||
my $session = WebGUI::Test->session; | ||
|
||
plan tests => 4; | ||
|
||
my $i18n = WebGUI::International->new($session, 'Macro_SpectreCheck'); | ||
|
||
is WebGUI::Macro::SpectreCheck::process($session), $i18n->get('spectre'), 'with no status, get an i18n message for a bad spectre'; | ||
|
||
$spectreStatus = 'success'; | ||
is WebGUI::Macro::SpectreCheck::process($session), $i18n->get('success'), 'good status'; | ||
$spectreStatus = 'subnet'; | ||
is WebGUI::Macro::SpectreCheck::process($session), $i18n->get('subnet'), 'bad subnet'; | ||
$spectreStatus = 'spectre'; | ||
is WebGUI::Macro::SpectreCheck::process($session), $i18n->get('spectre'), 'bad spectre'; | ||
|
||
*WebGUI::Operation::Spectre::spectreTest = $original_spectreCheck; |