Skip to content

Commit

Permalink
Item13870: Update unit test for RCS Checker
Browse files Browse the repository at this point in the history
 - Add a Reporter and verify the returned note.
 - Also negative test - verify note for bogus command.
  • Loading branch information
gac410 committed Nov 29, 2015
1 parent f48cf75 commit 651eda6
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions RCSStoreContrib/test/unit/RCSStoreContrib/RCSConfigureTests.pm
Expand Up @@ -11,20 +11,31 @@ use File::Temp();
use FindBin;
use File::Path qw(mkpath rmtree);

use Foswiki::Configure::Checkers::RCSChecker ();
use Foswiki::Configure::Checkers::RCSChecker ();

#Item11955
sub test_checkRCSProgram {
my ($this) = @_;
my $checkerObj =
Foswiki::Configure::Checkers::RCSChecker->new('Test::Foswiki::Configure::Dummy');
Foswiki::Configure::Checkers::RCSChecker->new(
'Test::Foswiki::Configure::Dummy');
my $reporter = Foswiki::Configure::Reporter->new();
$checkerObj->{reporter} = $reporter;

$this->assert( !exists $Foswiki::cfg{RCS}{foo} );
local $Foswiki::cfg{Store}{Implementation} = 'Foswiki::Store::RcsWrap';

# Don't forget that the cmd is sanitized/untainted...
local $Foswiki::cfg{RCS}{foo} = 'rcs';
$this->assert( !$checkerObj->checkRCSProgram('foo') );
$this->assert_matches( qr/^rcs (.*) detected.$/,
$checkerObj->checkRCSProgram( 'foo', $reporter ) );

# Test an invalid command, make sure it fails.
local $Foswiki::cfg{RCS}{foo} = 'xxrcs';
$this->assert_matches(
qr/^RCS command xxrcs failed, may not be installed, or found on path./,
$checkerObj->checkRCSProgram( 'foo', $reporter )
);

return;
}
Expand Down

0 comments on commit 651eda6

Please sign in to comment.