616
|
1 |
"{ Package: 'exept:regression' }"
|
|
2 |
|
|
3 |
"{ NameSpace: RegressionTests }"
|
|
4 |
|
|
5 |
TestCase subclass:#LiteralsInMethodTests
|
|
6 |
instanceVariableNames:''
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'tests-Regression'
|
|
10 |
!
|
|
11 |
|
|
12 |
!LiteralsInMethodTests class methodsFor:'documentation'!
|
|
13 |
|
|
14 |
documentation
|
|
15 |
"
|
|
16 |
documentation to be added.
|
|
17 |
|
|
18 |
[author:]
|
|
19 |
cg
|
|
20 |
|
|
21 |
[instance variables:]
|
|
22 |
|
|
23 |
[class variables:]
|
|
24 |
|
|
25 |
[see also:]
|
|
26 |
|
|
27 |
"
|
|
28 |
! !
|
|
29 |
|
|
30 |
!LiteralsInMethodTests methodsFor:'tested methods'!
|
|
31 |
|
|
32 |
classCheck:arg
|
|
33 |
"only a check-method"
|
|
34 |
|
|
35 |
(arg class == Array) ifTrue:[
|
|
36 |
arg yourself
|
|
37 |
].
|
|
38 |
|
|
39 |
"Created: / 08-08-2011 / 20:26:31 / cg"
|
|
40 |
!
|
|
41 |
|
|
42 |
methodWithStringLiteral1
|
|
43 |
^ 'abcd'
|
|
44 |
|
|
45 |
"Created: / 08-08-2011 / 17:14:10 / cg"
|
|
46 |
!
|
|
47 |
|
|
48 |
methodWithStringLiteral2
|
|
49 |
^ 'abc'
|
|
50 |
|
|
51 |
"Created: / 08-08-2011 / 17:14:13 / cg"
|
|
52 |
! !
|
|
53 |
|
|
54 |
!LiteralsInMethodTests methodsFor:'tests'!
|
|
55 |
|
|
56 |
test01_methodContainsLiterals
|
|
57 |
"old stc/compiler versions did not generate literals for inlined
|
|
58 |
sends, which made problems when quick-searching for senders (which filters
|
|
59 |
candidate-methods using the literal array"
|
|
60 |
|
|
61 |
|m|
|
|
62 |
|
|
63 |
m := self class compiledMethodAt:#classCheck:.
|
|
64 |
self assert:(m literals includes:#'==').
|
|
65 |
self assert:(m literals includes:#'class').
|
|
66 |
self assert:(m literals includes:#'yourself').
|
|
67 |
|
|
68 |
"
|
|
69 |
self run:#test01_methodContainsLiterals
|
|
70 |
self new test01_methodContainsLiterals
|
|
71 |
"
|
|
72 |
|
|
73 |
"Created: / 08-08-2011 / 16:33:06 / cg"
|
|
74 |
!
|
|
75 |
|
|
76 |
test02_patternStringLiteral
|
|
77 |
"/ for now, only bytecode contains string literals - skip this.
|
|
78 |
"/ |m|
|
|
79 |
"/
|
|
80 |
"/ m := self class compiledMethodAt:#methodWithStringLiteral.
|
|
81 |
|
|
82 |
"
|
|
83 |
self run:#test01_methodContainsLiterals
|
|
84 |
self new test01_methodContainsLiterals
|
|
85 |
"
|
|
86 |
|
|
87 |
"Created: / 08-08-2011 / 16:54:28 / cg"
|
|
88 |
! !
|
|
89 |
|
|
90 |
!LiteralsInMethodTests class methodsFor:'documentation'!
|
|
91 |
|
|
92 |
version
|
|
93 |
^ '$Header$'
|
|
94 |
!
|
|
95 |
|
|
96 |
version_CVS
|
|
97 |
^ '$Header$'
|
|
98 |
! !
|