1447
|
1 |
"{ Package: 'stx:goodies/regression' }"
|
330
|
2 |
|
|
3 |
"{ NameSpace: RegressionTests }"
|
|
4 |
|
|
5 |
TestCase subclass:#URLTest
|
|
6 |
instanceVariableNames:''
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'tests-Regression'
|
|
10 |
!
|
|
11 |
|
|
12 |
|
|
13 |
!URLTest methodsFor:'testing'!
|
|
14 |
|
|
15 |
test01_fromString
|
|
16 |
|u|
|
|
17 |
|
|
18 |
u := URL fromString:'foo'.
|
|
19 |
self assert:u host isNil.
|
|
20 |
self assert:u path = 'foo'.
|
|
21 |
self assert:u method isNil.
|
|
22 |
self assert:u port isNil.
|
|
23 |
|
|
24 |
u := URL fromString:'fff/'.
|
|
25 |
self assert:u host isNil.
|
|
26 |
self assert:u path = 'fff/'.
|
|
27 |
self assert:u method isNil.
|
|
28 |
self assert:u port isNil.
|
|
29 |
|
|
30 |
u := URL fromString:'localhost:8080/'.
|
|
31 |
self assert:u host = 'localhost'.
|
|
32 |
self assert:u path isEmptyOrNil.
|
|
33 |
self assert:u method isNil.
|
|
34 |
self assert:u port = 8080.
|
|
35 |
|
|
36 |
u := URL fromString:'http://localhost/'.
|
|
37 |
self assert:u host = 'localhost'.
|
|
38 |
self assert:u path isEmptyOrNil.
|
|
39 |
self assert:u method = 'http'.
|
|
40 |
|
|
41 |
u := URL fromString:'http://www.exept.de/'.
|
|
42 |
self assert:u host = 'www.exept.de'.
|
|
43 |
self assert:u path isEmptyOrNil.
|
|
44 |
self assert:u method = 'http'.
|
|
45 |
|
|
46 |
"
|
|
47 |
self new test01_fromString
|
|
48 |
"
|
1595
|
49 |
|
|
50 |
"Modified: / 28-02-2017 / 16:04:43 / cg"
|
330
|
51 |
!
|
|
52 |
|
|
53 |
test02_construct
|
|
54 |
|u1 u2|
|
|
55 |
|
|
56 |
u1 := URL fromString:'http://localhost/'.
|
|
57 |
|
|
58 |
u2 := u1 construct:'subdir1'.
|
|
59 |
self assert:u2 host = 'localhost'.
|
|
60 |
self assert:u2 path = '/subdir1'.
|
|
61 |
self assert:u2 method = 'http'.
|
|
62 |
self assert:u2 port isNil.
|
|
63 |
|
|
64 |
u2 := u1 construct:'/subdir1'.
|
|
65 |
self assert:u2 host = 'localhost'.
|
|
66 |
self assert:u2 path = '/subdir1'.
|
|
67 |
self assert:u2 method = 'http'.
|
|
68 |
self assert:u2 port isNil.
|
|
69 |
|
|
70 |
u2 := u1 construct:'http://www.google.de:/top.html'.
|
|
71 |
self assert:u2 host = 'www.google.de'.
|
|
72 |
self assert:u2 path = '/top.html'.
|
|
73 |
self assert:u2 method = 'http'.
|
|
74 |
self assert:u2 port isNil.
|
|
75 |
|
|
76 |
"
|
|
77 |
self new test02_construct
|
|
78 |
"
|
1595
|
79 |
!
|
|
80 |
|
|
81 |
test03_missingParts
|
|
82 |
|u|
|
|
83 |
|
|
84 |
u := URL fromString:'http://:8080/foo'.
|
|
85 |
self assert:u host isNil.
|
|
86 |
self assert:u path = '/foo'.
|
|
87 |
self assert:u method = 'http'.
|
|
88 |
self assert:u port = 8080.
|
|
89 |
|
|
90 |
"
|
|
91 |
self new test03_missingParts
|
|
92 |
"
|
|
93 |
|
|
94 |
"Created: / 28-02-2017 / 16:05:44 / cg"
|
330
|
95 |
! !
|
|
96 |
|
|
97 |
!URLTest class methodsFor:'documentation'!
|
|
98 |
|
|
99 |
version
|
|
100 |
^ '$Header$'
|
|
101 |
! !
|
1595
|
102 |
|