ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/URL/test/test_URLclass.pm
Revision: 1.1
Committed: Fri Nov 12 16:02:04 1999 UTC (25 years, 6 months ago) by williamc
Content type: text/plain
Branch: MAIN
Log Message:
Add URLclass tests

File Contents

# User Rev Content
1 williamc 1.1 #
2     # CVS url handler test suite
3     #
4    
5     package URL::test::test_URLclass;
6     require 5.001;
7     use URL::URLbase;
8     @ISA = ("TestClass"); #methods both from the test class
9    
10     sub init {
11     my $self=shift;
12     $type1=URL::URLbase->new({ base=>'Ahello' });
13     $type2=URL::URLbase->new({ base=>'Bhello', var1=>"val1", var2=>"val2" });
14     $type3=URL::URLbase->new({ base=>'Chello', "param1++"=>"wrong", var2=>val2 });
15     $type4=URL::URLbase->new({}); # an empty base
16     }
17    
18     sub test {
19     my $self=shift;
20    
21     # test 1
22     $self->newtest("Testing simple url");
23     $urlA="A:test";
24     $urlB="B:test?param1++=H&param2=T";
25     $self->newobject($urlA);
26     $self->expect("A");
27     $self->testinterface("type");
28     $self->clearexpect();
29     $self->_urlbasictest($urlA);
30     $self->newtest("full url without parameters");
31     $self->expect("A://test");
32     $self->testinterface("url");
33     $self->clearexpect();
34     $self->newtest("url without parameters - expanded");
35     $self->testinterface("expandurl", $type1);
36     $self->expect("A://Ahello/test");
37     $self->testinterface("url");
38     $self->clearexpect();
39     $self->testinterface("expandurl", $type2);
40     $self->expect("A://Bhello/test?var1=val1&var2=val2");
41     $self->testinterface("url");
42     $self->clearexpect();
43     $self->newtest("url with parameters");
44     $self->newobject($urlB);
45     $self->_urlbasictest($urlB);
46     $self->newtest("full url with parameters");
47     $self->expect("B://test?param1++=H&param2=T");
48     $self->testinterface("url");
49     $self->clearexpect();
50     $self->testinterface("expandurl", $type2);
51     $self->expect
52     ("B://Bhello/test?param1++=H&var1=val1&var2=val2&param2=T");
53     $self->testinterface("url");
54     $self->clearexpect();
55     $self->testinterface("expandurl", $type3);
56     $self->expect
57     ("B://Chello/test?param1++=H&var2=val2&param2=T");
58     $self->testinterface("url");
59     $self->clearexpect();
60    
61     $self->newtest("empty base test");
62     $self->testinterface("expandurl", $type4);
63     $self->expect("B://test?param1++=H&param2=T");
64     $self->testinterface("url");
65     $self->clearexpect();
66     $self->newtest("Initialised with a full url");
67     my $urlC="C://Bhello:/test?param1++=H&var1=val1?&var2=val2";
68     $self->newobject($urlC);
69     $self->expect($urlC);
70     $self->testinterface("url");
71     $self->clearexpect();
72     $self->newtest("file test");
73     $self->expect("test");
74     $self->testinterface("file");
75     $self->clearexpect();
76    
77     }
78    
79     sub _urlbasictest {
80     my $self=shift;
81     my $url=shift;
82     $self->newtest("Basic test for url $url");
83     $self->newobject($url);
84     $self->expect($url);
85     $self->testinterface("origurl");
86     $self->clearexpect();
87     }