[Lxr-commits] CVS: lxr/tests BKTest.pm,NONE,1.1.2.1 AllTests.pm,1.1,1.1.4.1 ConfigTest.pm,1.2,1.2.2.
Brought to you by:
ajlittoz
From: Malcolm B. <mb...@us...> - 2004-12-04 23:31:35
|
Update of /cvsroot/lxr/lxr/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12463/tests Modified Files: Tag: bk-dev-branch AllTests.pm ConfigTest.pm Added Files: Tag: bk-dev-branch BKTest.pm Log Message: Start of work on BitKeeper support - add new Files access mode for BK --- NEW FILE: BKTest.pm --- # Test cases for the LXR::Files::BK module # Uses the associated lxr.conf file package BKTest; use strict; use Test::Unit; use lib ".."; use lib "../lib"; use LXR::Files; use base qw(Test::Unit::TestCase); sub new { my $self = shift()->SUPER::new(@_); $self->{config} = 0; return $self; } # define tests # test that a bk files object can be created sub test_creation { my $self = shift; $self->assert(defined($self->{files}), "Failed to create Files::BK"); $self->assert($self->{files}->isa("LXR::Files::BK"), "Not a BK object"); } # Access some of the values to check what is found sub test_root { my $self = shift; $self->assert($self->{files}->{rootpath} eq '/a/path/', "rootpath failed $self->{files}->{rootpath}"); } # Test the allreleases function sub test_allreleases { my $self = shift; $self->assert($self->allreleases("testfile") eq 1); } # set_up and tear_down are used to # prepare and release resources need for testing # Prepare a config object sub set_up { my $self = shift; $self->{files} = new LXR::Files("bk:/a/path"); } sub tear_down { my $self = shift; # $self->{config} = undef; } 1; Index: AllTests.pm =================================================================== RCS file: /cvsroot/lxr/lxr/tests/AllTests.pm,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -u -d -r1.1 -r1.1.4.1 --- AllTests.pm 4 Mar 2002 15:11:27 -0000 1.1 +++ AllTests.pm 4 Dec 2004 23:31:15 -0000 1.1.4.1 @@ -14,6 +14,7 @@ my $class = shift; my $suite = Test::Unit::TestSuite->empty_new("LXR Tests"); $suite->add_test(Test::Unit::TestSuite->new("ConfigTest")); + $suite->add_test(Test::Unit::TestSuite->new("BKTest")); return $suite; } Index: ConfigTest.pm =================================================================== RCS file: /cvsroot/lxr/lxr/tests/ConfigTest.pm,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -d -r1.2 -r1.2.2.1 --- ConfigTest.pm 6 Sep 2004 21:54:45 -0000 1.2 +++ ConfigTest.pm 4 Dec 2004 23:31:15 -0000 1.2.2.1 @@ -49,9 +49,16 @@ my @vars = $self->{config}->allvariables(); $self->assert(grep {$_ eq 'v'} @vars, "allvariables didn't return v"); $self->assert(grep {$_ eq 'a'} @vars, "allvariables didn't return a"); - $self->assert($#vars == 1, "Too many variables returned got " . $self->{config}->allvariables()); + $self->assert($#vars == 1, "Too many variables returned got @vars"); } +# Test multiple config block with common substrings work +# Bug 525825 +sub test_multi_config { + my $self = shift; + my $test = eval {new LXR::Config("http://test/lxr-wibble", "./lxr.conf");}; + $self->assert(!defined($test), "Should not have matched"); + } # set_up and tear_down are used to # prepare and release resources need for testing |