author | Claus Gittinger <cg@exept.de> |
Wed, 03 Apr 2013 15:28:18 +0200 | |
changeset 871 | 098316a54e40 |
parent 870 | 577f844aedf7 |
child 899 | 4375bdf77fd2 |
permissions | -rw-r--r-- |
784 | 1 |
"{ Package: 'exept:regression' }" |
2 |
||
3 |
"{ NameSpace: RegressionTests }" |
|
4 |
||
5 |
TestCase subclass:#CompilerTests2 |
|
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
823 | 9 |
category:'tests-Regression' |
784 | 10 |
! |
11 |
||
12 |
||
13 |
!CompilerTests2 methodsFor:'setup'! |
|
14 |
||
15 |
tearDown |
|
16 |
||
17 |
(Smalltalk at: #'exept_regression_testData_CompilerTests2') notNil ifTrue:[ |
|
823 | 18 |
(Smalltalk at: #'exept_regression_testData_CompilerTests2') classes do:[:e| |
19 |
e notNil ifTrue:[ |
|
20 |
Smalltalk removeClass: e |
|
21 |
]. |
|
22 |
] |
|
784 | 23 |
]. |
24 |
||
25 |
"Created: / 26-10-2012 / 11:32:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
26 |
"Modified: / 12-02-2013 / 16:12:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
27 |
! ! |
|
28 |
||
29 |
!CompilerTests2 methodsFor:'tests'! |
|
30 |
||
31 |
test_01 |
|
823 | 32 |
"JV@2012-10-26: |
784 | 33 |
|
823 | 34 |
When a package is loaded from source using |
784 | 35 |
|
870
577f844aedf7
class: RegressionTests::CompilerTests2
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
36 |
Smalltalk loadPackage:'...' |
784 | 37 |
|
823 | 38 |
expression __EVALUATED FROM WORKSPACE__ AND a method from loaded class |
39 |
uses a class from the same package that is not yet loaded (i.e., it will |
|
40 |
be loaded later), |
|
784 | 41 |
|
823 | 42 |
then the compiler as of 2012-10-26 generates access to a workspace variable |
784 | 43 |
instead of access to a global |
44 |
||
45 |
This tests checks for this bug |
|
46 |
" |
|
47 |
||
48 |
| ws | |
|
49 |
||
870
577f844aedf7
class: RegressionTests::CompilerTests2
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
50 |
"/ this test only works with a Display... |
871
098316a54e40
class: RegressionTests::CompilerTests2
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
51 |
self skipIf:[Display isNil] description:'Test requires a Display'. |
870
577f844aedf7
class: RegressionTests::CompilerTests2
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
52 |
|
784 | 53 |
"/First, make sure that package is not yet loaded... |
823 | 54 |
self |
870
577f844aedf7
class: RegressionTests::CompilerTests2
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
55 |
assert: (Smalltalk at: #'exept_regression_testData_CompilerTests2') isNil |
577f844aedf7
class: RegressionTests::CompilerTests2
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
56 |
description: 'Mock package already loaded'. |
784 | 57 |
|
58 |
ws := WorkspaceApplication new. |
|
870
577f844aedf7
class: RegressionTests::CompilerTests2
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
59 |
ws selectedWorkspace |
577f844aedf7
class: RegressionTests::CompilerTests2
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
60 |
contents: '(Smalltalk loadPackage: #''exept:regression/testData/CompilerTests2'')'; |
577f844aedf7
class: RegressionTests::CompilerTests2
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
61 |
selectAll; |
577f844aedf7
class: RegressionTests::CompilerTests2
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
62 |
doIt. |
784 | 63 |
|
823 | 64 |
self assert: (Smalltalk at: #'RegressionTests::CompilerTests2Mock1') new foo class |
870
577f844aedf7
class: RegressionTests::CompilerTests2
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
65 |
== (Smalltalk at: #'RegressionTests::CompilerTests2Mock2') |
784 | 66 |
|
67 |
"Created: / 26-10-2012 / 11:59:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
68 |
"Modified (comment): / 12-02-2013 / 16:24:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
69 |
! |
|
70 |
||
71 |
test_02 |
|
823 | 72 |
"JV@2012-10-26: |
784 | 73 |
|
823 | 74 |
When a package is loaded from source using |
784 | 75 |
|
823 | 76 |
Smalltalk loadPackage:'...' |
784 | 77 |
|
823 | 78 |
expression and a method from loaded class in namespace uses a class from the |
79 |
same package and same namespace, that is not yet loaded (i.e., it will be loaded |
|
80 |
later), |
|
784 | 81 |
|
82 |
then the compiler as of 2012-10-26 generates access to class in no namespace. |
|
83 |
||
84 |
This test checks for this bug |
|
85 |
" |
|
86 |
||
87 |
"/First, make sure that package is not yet loaded... |
|
823 | 88 |
self |
89 |
assert: (Smalltalk at: #'exept_regression_estData_CompilerTests2') isNil |
|
90 |
description: 'Mock package already loaded'. |
|
784 | 91 |
|
823 | 92 |
self |
93 |
assert: (Smalltalk loadPackage: #'exept:regression/testData/CompilerTests2') |
|
94 |
description: 'Cannot load mock package!!'. |
|
784 | 95 |
|
96 |
||
823 | 97 |
self assert: (Smalltalk at: #'RegressionTests::CompilerTests2Mock1') new foo class |
98 |
== (Smalltalk at: #'RegressionTests::CompilerTests2Mock2') |
|
784 | 99 |
|
100 |
"Created: / 26-10-2012 / 12:26:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
101 |
"Modified (comment): / 12-02-2013 / 16:24:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
102 |
! ! |
|
103 |
||
104 |
!CompilerTests2 class methodsFor:'documentation'! |
|
105 |
||
106 |
version |
|
107 |
^ '$Header$' |
|
108 |
! |
|
109 |
||
110 |
version_CVS |
|
111 |
^ '$Header$' |
|
112 |
! |
|
113 |
||
114 |
version_SVN |
|
115 |
^ '§Id:: RegressionTests__CompilerTests2.st 506 2012-10-26 12:03:11Z vranyj1 §' |
|
116 |
! ! |
|
870
577f844aedf7
class: RegressionTests::CompilerTests2
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
117 |