author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 31 Aug 2015 14:01:56 +0100 | |
changeset 3 | ed5aae792d24 |
parent 0 | 43cb9f3e345e |
permissions | -rw-r--r-- |
0 | 1 |
"{ Package: 'stx:goodies/ring/tests' }" |
2 |
||
3 |
"{ NameSpace: Smalltalk }" |
|
4 |
||
5 |
TestCase subclass:#RGGlobalDefinitionTest |
|
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'Ring-Core-Kernel-Tests' |
|
10 |
! |
|
11 |
||
12 |
RGGlobalDefinitionTest comment:'SUnit tests for global definitions (pools, global variables)' |
|
13 |
! |
|
14 |
||
15 |
||
16 |
!RGGlobalDefinitionTest methodsFor:'testing'! |
|
17 |
||
18 |
testEquality |
|
19 |
| global1 global2 | |
|
20 |
||
21 |
global1 := RGGlobalVariableDefinition named: #Transcript. |
|
22 |
global2 := RGGlobalVariableDefinition named: #Transcript. |
|
23 |
self assert: global1 = global2. |
|
24 |
||
25 |
global2 := RGGlobalVariableDefinition named: #Transcript2. |
|
26 |
self deny: global1 = global2. |
|
27 |
! |
|
28 |
||
29 |
testGlobalVariableDefinition |
|
30 |
| global | |
|
31 |
||
32 |
global:= RGGlobalVariableDefinition named: #Transcript. |
|
33 |
self assert: (global isGlobalVariable). |
|
34 |
self assert: (global parent = Smalltalk globals). |
|
35 |
! |
|
36 |
||
37 |
testPoolDefinition |
|
38 |
| pool newClass | |
|
3
ed5aae792d24
More Smalltalk/X API methods. Better RGClassDefinition creation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
39 |
pool := RGClassDefinition newSharedPoolNamed:#TextConstants. |
0 | 40 |
self assert: pool isPool. |
41 |
self assert: pool users isEmpty. |
|
42 |
self assert: pool parent equals: Smalltalk globals. |
|
43 |
newClass := RGClassDefinition named: #OrderedCollection. |
|
44 |
pool addUser: newClass. |
|
45 |
self assert: pool users size equals: 1. |
|
46 |
self assert: (pool includesUser: newClass). |
|
47 |
self assert: (newClass sharedPoolNamed: #TextConstants) isPoolVariable. |
|
48 |
pool := RGClassDefinition named: #TextConstants. |
|
49 |
pool superclassName: #SharedPool. |
|
50 |
self assert: pool isPool. |
|
51 |
self assert: pool users isEmpty |
|
52 |
! ! |
|
53 |
||
54 |
!RGGlobalDefinitionTest class methodsFor:'documentation'! |
|
55 |
||
56 |
version_HG |
|
57 |
||
58 |
^ '$Changeset: <not expanded> $' |
|
59 |
! ! |
|
60 |