ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/ActiveDoc/test/test_PreProcessedFile.pm
Revision: 1.3
Committed: Fri Dec 17 08:37:45 1999 UTC (25 years, 4 months ago) by williamc
Content type: text/plain
Branch: MAIN
Changes since 1.2: +6 -6 lines
Log Message:
new tests

File Contents

# User Rev Content
1 williamc 1.1 #
2     # PreProcessedFile test suite
3     #
4    
5     package ActiveDoc::test::test_PreProcessedFile;
6     require 5.001;
7     use ActiveDoc::PreProcessedFile;
8     use ActiveDoc::ActiveConfig;
9    
10     @ISA = ("TestClass"); #methods both from the test class
11    
12     sub init {
13     my $self=shift;
14     $self->{testfile}=$self->datadir()."/PreProcessorTest";
15     $self->{checktestfile}=$self->datadir()."/PreProcessorTest-check";
16     $self->{ActiveConfig}=ActiveDoc::ActiveConfig->new($self->temparea()."/PreProcessortest");
17     }
18    
19 williamc 1.2 sub linetest {
20     my $self=shift;
21    
22 williamc 1.1 # line tracing
23     $self->newtest("line tracing test");
24     $self->expect(2);
25 williamc 1.3 $self->testinterface(qw(realline 2));
26 williamc 1.1 $self->clearexpect();
27     $self->expect(2);
28 williamc 1.3 $self->testinterface(qw(realline 4));
29 williamc 1.1 $self->clearexpect();
30     $self->expect(4);
31 williamc 1.3 $self->testinterface(qw(realline 6));
32 williamc 1.1 $self->clearexpect();
33     $self->expect(2);
34 williamc 1.3 $self->testinterface(qw(realline 8));
35 williamc 1.1 $self->clearexpect();
36     $self->expect(4);
37 williamc 1.3 $self->testinterface(qw(realline 10));
38 williamc 1.1 $self->clearexpect();
39     $self->expect(12);
40 williamc 1.3 $self->testinterface(qw(realline 40));
41 williamc 1.1 $self->clearexpect();
42 williamc 1.2
43     }
44    
45     sub test {
46     my $self=shift;
47    
48     $self->newtest("Initiation test");
49     $self->newobject($self->{ActiveConfig});
50 williamc 1.1
51     $self->newtest("New Object");
52     $self->newobject($self->{ActiveConfig});
53    
54     $self->newtest("url test");
55     $self->testinterface("url","file:".$self->{testfile});
56 williamc 1.2 ($expectedurl=$self->{testfile})=~s/(\/Pre.*)/\/$1/;
57     $self->expect("file://".$expectedurl);
58 williamc 1.1 $self->testinterface("url");
59     $self->clearexpect();
60    
61     $self->newtest("File test");
62 williamc 1.2 my $origfile=$self->testinterface("file");
63     $self->verify($origfile, $self->{testfile});
64 williamc 1.1
65 williamc 1.2 $self->newtest("Construction test");
66 williamc 1.1 $self->testinterface("update");
67 williamc 1.2 my $file=$self->testinterface("ProcessedFile");
68     $self->verify($file,$self->{checktestfile});
69    
70     $self->newtest("Store/Restore test");
71     my $storefile=$self->temparea()."/".$self->newfilename();
72     $self->testinterface("store", $storefile);
73     $self->testinterface("store", $storefile); # multiple calls to store
74     # must be possible
75     $self->newobject($self->{ActiveConfig});
76     $self->testinterface("restore", $storefile);
77     $self->linetest();
78    
79     $self->expect($file);
80     $self->testinterface("ProcessedFile");
81     $self->clearexpect();
82    
83     $self->expect($origfile);
84     $self->testinterface("file");
85     $self->clearexpect();
86    
87     if ( $self->{object}->{lastsequence} ne 1 ) {
88     $self->testfail("sequence number corrupted got ".
89     $self->{object}->{lastsequence});
90     }
91     else {
92     $self->testpass('sequence number stored OK');
93     }
94    
95     $self->newtest("Update test - out of date check");
96     $self->testinterface("update");
97     @array=$self->testinterface("updatedfiles");
98     if ( $#array != -1 ) {
99     $self->testfail("Files were updated @array when none should of been");
100     }
101     $self->testpass("No files updated therefore no build as expected");
102    
103 williamc 1.1 $file=$self->testinterface("ProcessedFile");
104 williamc 1.2 $self->verify($file,$self->{checktestfile});
105 williamc 1.1
106 williamc 1.2 $self->newtest("Update test - dependency changed");
107     $changedurl="cvs://cmscvs.cern.ch:/cvs_server/repositories/SCRAM//test/testinclude3?auth=pserver&passkey=AA_:yZZ3e&user=anonymous";
108     $changedurl2="cvs://cmscvs.cern.ch:/cvs_server/repositories/SCRAM//test/testinclude?auth=pserver&passkey=AA_:yZZ3e&user=anonymous";
109     $self->{object}->{urlhandler}->download($changedurl);
110     $self->testinterface("update");
111     $self->expect($changedurl2);
112     $self->testinterface("updatedfiles");
113     $self->clearexpect();
114     $file=$self->testinterface("ProcessedFile");
115 williamc 1.1 $self->verify($file,$self->{checktestfile});
116     }