Changeset 12900


Ignore:
Timestamp:
10/27/11 16:24:32 (19 months ago)
Author:
GeorgeClark
Message:

Item11209: Unit test to expose issue

Modifing the txt file should not change results from older revisions.

Also the modified timestamp should not drift forwards.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Release01x01/UnitTestContrib/test/unit/RCSHandlerTests.pm

    r12497 r12900  
    559559} 
    560560 
     561sub verify_OutOfDate_RevInfo { 
     562    my ($this) = @_; 
     563 
     564    my $rcs = $class->new( new StoreStub, $testWeb, 'RevInfo', "" ); 
     565 
     566    $rcs->addRevisionFromText( "Rev1\n", 'FirstComment',  "FirstUser",  0 ); 
     567    $rcs->addRevisionFromText( "Rev2\n", 'SecondComment', "SecondUser", 1000 ); 
     568    $rcs->addRevisionFromText( "Rev3\n", 'ThirdComment',  "ThirdUser",  2000 ); 
     569 
     570    $rcs = $class->new( new StoreStub, $testWeb, 'RevInfo', "" ); 
     571 
     572    my $info = $rcs->getInfo(1); 
     573    $this->assert_equals( 1, $info->{version} ); 
     574    $this->assert_equals( 0, $info->{date} ); 
     575    $this->assert_str_equals( 'FirstUser',    $info->{author} ); 
     576    $this->assert_str_equals( 'FirstComment', $info->{comment} ); 
     577 
     578    $info = $rcs->getInfo(2); 
     579    $this->assert_equals( 2,    $info->{version} ); 
     580    $this->assert_equals( 1000, $info->{date} ); 
     581    $this->assert_str_equals( 'SecondUser',    $info->{author} ); 
     582    $this->assert_str_equals( 'SecondComment', $info->{comment} ); 
     583 
     584    $info = $rcs->getInfo(3); 
     585    $this->assert_equals( 3,    $info->{version} ); 
     586    $this->assert_equals( 2000, $info->{date} ); 
     587    $this->assert_str_equals( 'ThirdUser',    $info->{author} ); 
     588    $this->assert_str_equals( 'ThirdComment', $info->{comment} ); 
     589 
     590    $info = $rcs->getInfo(0); 
     591    $this->assert_equals( 3,    $info->{version} ); 
     592    $this->assert_equals( 2000, $info->{date} ); 
     593    $this->assert_str_equals( 'ThirdUser',    $info->{author} ); 
     594    $this->assert_str_equals( 'ThirdComment', $info->{comment} ); 
     595 
     596    $info = $rcs->getInfo(4); 
     597    $this->assert_equals( 3,    $info->{version} ); 
     598    $this->assert_equals( 2000, $info->{date} ); 
     599    $this->assert_str_equals( 'ThirdUser',    $info->{author} ); 
     600    $this->assert_str_equals( 'ThirdComment', $info->{comment} ); 
     601 
     602 
     603    sleep 5; 
     604    open( FH, '>>', "$rcs->{file}" ); 
     605    print FH "Modified"; 
     606    close FH; 
     607 
     608    $info = $rcs->getInfo(0); 
     609    my $time1 = "$info->{date}\n"; 
     610    sleep 5; 
     611    $info = $rcs->getInfo(0); 
     612    my $time2 = "$info->{date}\n"; 
     613 
     614    $this->assert_equals( $time1, $time2 ); 
     615 
     616    $info = $rcs->getInfo(1); 
     617    $this->assert_equals( 1, $info->{version} ); 
     618    $this->assert_equals( 0, $info->{date} ); 
     619    $this->assert_str_equals( 'FirstUser',    $info->{author} ); 
     620    $this->assert_str_equals( 'FirstComment', $info->{comment} ); 
     621 
     622    $info = $rcs->getInfo(2); 
     623    $this->assert_equals( 2,    $info->{version} ); 
     624    $this->assert_equals( 1000, $info->{date} ); 
     625    $this->assert_str_equals( 'SecondUser',    $info->{author} ); 
     626    $this->assert_str_equals( 'SecondComment', $info->{comment} ); 
     627 
     628    $info = $rcs->getInfo(3); 
     629    $this->assert_equals( 3,    $info->{version} ); 
     630    $this->assert_equals( 2000, $info->{date} ); 
     631    $this->assert_str_equals( 'ThirdUser',    $info->{author} ); 
     632    $this->assert_str_equals( 'ThirdComment', $info->{comment} ); 
     633 
     634    $info = $rcs->getInfo(0); 
     635    $this->assert_equals( 3,    $info->{version} ); 
     636    $this->assert_equals( 2000, $info->{date} ); 
     637    $this->assert_str_equals( 'ThirdUser',    $info->{author} ); 
     638    $this->assert_str_equals( 'ThirdComment', $info->{comment} ); 
     639 
     640    $info = $rcs->getInfo(4); 
     641    $this->assert_equals( 3,    $info->{version} ); 
     642    $this->assert_equals( 2000, $info->{date} ); 
     643    $this->assert_str_equals( 'ThirdUser',    $info->{author} ); 
     644    $this->assert_str_equals( 'ThirdComment', $info->{comment} ); 
     645 
     646} 
     647 
    561648# If a .txt file exists with no ,v and we perform an op on that 
    562649# file, a ,v must be created for rev 1 before the op is completed. 
Note: See TracChangeset for help on using the changeset viewer.