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 |
|
|
sub test {
|
20 |
|
|
my $self=shift;
|
21 |
|
|
|
22 |
|
|
$self->newtest("Initiation test");
|
23 |
|
|
$self->newobject($self->{ActiveConfig});
|
24 |
|
|
|
25 |
|
|
$self->newtest("includefile test");
|
26 |
|
|
$self->testinterface(qw(includefile ID1 3 3 3));
|
27 |
|
|
$self->testinterface(qw(includefile ID2 5 8 30));
|
28 |
|
|
|
29 |
|
|
# create some other objects in the database
|
30 |
|
|
$ID1=ActiveDoc::PreProcessedFile->new($self->{ActiveConfig});
|
31 |
|
|
$ID2=ActiveDoc::PreProcessedFile->new($self->{ActiveConfig});
|
32 |
|
|
$self->{ActiveConfig}->store($ID1, "ID1");
|
33 |
|
|
$self->{ActiveConfig}->store($ID2, "ID2");
|
34 |
|
|
|
35 |
|
|
# line tracing
|
36 |
|
|
$self->newtest("line tracing test");
|
37 |
|
|
$self->expect(2);
|
38 |
|
|
$self->testinterface(qw(line 2));
|
39 |
|
|
$self->clearexpect();
|
40 |
|
|
$self->expect(2);
|
41 |
|
|
$self->testinterface(qw(line 4));
|
42 |
|
|
$self->clearexpect();
|
43 |
|
|
$self->expect(4);
|
44 |
|
|
$self->testinterface(qw(line 6));
|
45 |
|
|
$self->clearexpect();
|
46 |
|
|
$self->expect(2);
|
47 |
|
|
$self->testinterface(qw(line 8));
|
48 |
|
|
$self->clearexpect();
|
49 |
|
|
$self->expect(4);
|
50 |
|
|
$self->testinterface(qw(line 10));
|
51 |
|
|
$self->clearexpect();
|
52 |
|
|
$self->expect(12);
|
53 |
|
|
$self->testinterface(qw(line 40));
|
54 |
|
|
$self->clearexpect();
|
55 |
|
|
|
56 |
|
|
$self->newtest("New Object");
|
57 |
|
|
$self->newobject($self->{ActiveConfig});
|
58 |
|
|
|
59 |
|
|
$self->newtest("url test");
|
60 |
|
|
$self->testinterface("url","file:".$self->{testfile});
|
61 |
|
|
$self->expect("file://".$self->{testfile});
|
62 |
|
|
$self->testinterface("url");
|
63 |
|
|
$self->clearexpect();
|
64 |
|
|
|
65 |
|
|
$self->newtest("File test");
|
66 |
|
|
my $file=$self->testinterface("file");
|
67 |
|
|
$self->verify($file, $self->{testfile});
|
68 |
|
|
|
69 |
|
|
$self->newtest("Update test");
|
70 |
|
|
my $testout=$self->temparea()."/".$self->newfilename();
|
71 |
|
|
$self->testinterface("update");
|
72 |
|
|
$file=$self->testinterface("ProcessedFile");
|
73 |
|
|
#$self->verify($testout,$self->{checktestfile});
|
74 |
|
|
|
75 |
|
|
$self->verify($file,$self->{checktestfile});
|
76 |
|
|
}
|