1797
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2006 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
"{ Package: 'stx:goodies/regression' }"
|
|
13 |
|
|
14 |
"{ NameSpace: RegressionTests }"
|
|
15 |
|
|
16 |
TestCase subclass:#SelectorNamespacesTests
|
|
17 |
instanceVariableNames:'ambiguousMessageSelector'
|
|
18 |
classVariableNames:''
|
|
19 |
poolDictionaries:''
|
|
20 |
category:'tests-Regression'
|
|
21 |
!
|
|
22 |
|
|
23 |
!SelectorNamespacesTests class methodsFor:'documentation'!
|
|
24 |
|
|
25 |
copyright
|
|
26 |
"
|
|
27 |
COPYRIGHT (c) 2006 by eXept Software AG
|
|
28 |
All Rights Reserved
|
|
29 |
|
|
30 |
This software is furnished under a license and may be used
|
|
31 |
only in accordance with the terms of that license and with the
|
|
32 |
inclusion of the above copyright notice. This software may not
|
|
33 |
be provided or otherwise made available to, or used by, any
|
|
34 |
other person. No title to or ownership of the software is
|
|
35 |
hereby transferred.
|
|
36 |
"
|
|
37 |
! !
|
|
38 |
|
|
39 |
!SelectorNamespacesTests methodsFor:'error handling'!
|
|
40 |
|
|
41 |
ambiguousMessage: aMessage
|
|
42 |
|
|
43 |
ambiguousMessageSelector := aMessage selector
|
|
44 |
|
|
45 |
"Created: / 19-08-2010 / 22:29:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
46 |
! !
|
|
47 |
|
|
48 |
!SelectorNamespacesTests methodsFor:'initialization & release'!
|
|
49 |
|
|
50 |
setUp
|
|
51 |
|
|
52 |
(NameSpace name: #TestNS3) import: (NameSpace name: #TestNS2).
|
|
53 |
|
|
54 |
(NameSpace name: #TestNS4) import: (NameSpace name: #TestNS1).
|
|
55 |
(NameSpace name: #TestNS4) import: (NameSpace name: #TestNS2).
|
|
56 |
|
|
57 |
ObjectMemory flushCaches
|
|
58 |
|
|
59 |
"Modified: / 21-07-2010 / 17:12:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
60 |
!
|
|
61 |
|
|
62 |
tearDown
|
|
63 |
|
|
64 |
(NameSpace name: #TestNS1) setImports: nil.
|
|
65 |
(NameSpace name: #TestNS2) setImports: nil.
|
|
66 |
(NameSpace name: #TestNS3) setImports: nil.
|
|
67 |
(NameSpace name: #TestNS4) setImports: nil.
|
|
68 |
|
|
69 |
"Created: / 21-07-2010 / 16:02:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
70 |
! !
|
|
71 |
|
|
72 |
!SelectorNamespacesTests methodsFor:'methods'!
|
|
73 |
|
|
74 |
bar
|
|
75 |
|
|
76 |
<namespace: #TestNS1 >
|
|
77 |
|
|
78 |
^self foo
|
|
79 |
|
|
80 |
"Created: / 21-07-2010 / 15:59:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
81 |
!
|
|
82 |
|
|
83 |
foo
|
|
84 |
<namespace: #TestNS1 >
|
|
85 |
|
|
86 |
^#foo_NS1
|
|
87 |
|
|
88 |
"Created: / 01-07-2010 / 18:09:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
89 |
"Modified: / 21-07-2010 / 15:45:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
90 |
!
|
|
91 |
|
|
92 |
foo
|
|
93 |
<namespace: #TestNS2 >
|
|
94 |
|
|
95 |
^#foo_NS2
|
|
96 |
|
|
97 |
"Created: / 21-07-2010 / 15:47:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
98 |
!
|
|
99 |
|
|
100 |
baz
|
|
101 |
|
|
102 |
<namespace: TestNS3>
|
|
103 |
|
|
104 |
^self foo
|
|
105 |
|
|
106 |
"Created: / 21-07-2010 / 16:00:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
107 |
!
|
|
108 |
|
|
109 |
qux
|
|
110 |
|
|
111 |
<namespace: TestNS4>
|
|
112 |
|
|
113 |
^self foo
|
|
114 |
|
|
115 |
"Created: / 21-07-2010 / 16:02:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
116 |
!
|
|
117 |
|
|
118 |
foo
|
|
119 |
|
|
120 |
^#foo
|
|
121 |
|
|
122 |
"Created: / 01-07-2010 / 18:09:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
123 |
"Modified: / 01-07-2010 / 20:46:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
124 |
! !
|
|
125 |
|
|
126 |
!SelectorNamespacesTests methodsFor:'tests'!
|
|
127 |
|
|
128 |
test_01
|
|
129 |
|
|
130 |
self assert: self foo == #foo.
|
|
131 |
self assert: self bar == #foo_NS1
|
|
132 |
|
|
133 |
"Created: / 01-07-2010 / 18:47:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
134 |
"Modified: / 21-07-2010 / 15:59:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
135 |
!
|
|
136 |
|
|
137 |
test_02
|
|
138 |
|
|
139 |
"Basic imports"
|
|
140 |
|
|
141 |
self assert:
|
|
142 |
((NameSpace name: #TestNS3) imports includes: (NameSpace name: #TestNS2)).
|
|
143 |
self assert: self baz == #foo_NS2.
|
|
144 |
|
|
145 |
"Created: / 21-07-2010 / 16:05:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
146 |
"Modified: / 21-07-2010 / 17:19:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
147 |
!
|
|
148 |
|
|
149 |
test_03
|
|
150 |
|
|
151 |
"Ambiguous send"
|
|
152 |
"Disable, I need a kind of unwind-protect on a C level.
|
|
153 |
Is that possible?"
|
|
154 |
|
|
155 |
self shouldnt:[self qux] raise: AmbiguousMessage.
|
|
156 |
self assert: ambiguousMessageSelector == #foo.
|
|
157 |
|
|
158 |
"Created: / 19-08-2010 / 22:28:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
159 |
! !
|
|
160 |
|
|
161 |
!SelectorNamespacesTests class methodsFor:'documentation'!
|
|
162 |
|
|
163 |
version_CVS
|
|
164 |
^ '$Header$'
|
|
165 |
!
|
|
166 |
|
|
167 |
version_SVN
|
|
168 |
^ '§ Id: SelectorNamespacesTests.st 10567 2010-08-19 20:39:34Z vranyj1 §'
|
|
169 |
! !
|