-
-
Notifications
You must be signed in to change notification settings - Fork 353
/
RGEnsureTraitTest.class.st
122 lines (90 loc) · 3.46 KB
/
RGEnsureTraitTest.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
Class {
#name : #RGEnsureTraitTest,
#superclass : #RGTest,
#instVars : [
'environment',
'definition'
],
#category : #'Ring-Tests-Core'
}
{ #category : #running }
RGEnsureTraitTest >> setUp [
super setUp.
environment := RGEnvironment new.
]
{ #category : #running }
RGEnsureTraitTest >> testClassTrait [
"test creation of named class trait on empty environment"
definition := environment ensureTraitNamed: 'SomeTrait classTrait'.
self assert: definition isClass not.
self assert: definition isMetaclass not.
self assert: definition isTrait.
self assert: definition isMetaclassTrait.
]
{ #category : #running }
RGEnsureTraitTest >> testClassTraitIfMetaclassAlreadyExists [
"test creation of named class trait if a related metaclass already exists"
| existing |
existing := (environment ensureClassNamed: 'SomeTrait class') baseClass .
self assert: (existing isClass).
self assert: (existing isRingResolved not).
definition := environment ensureTraitNamed: 'SomeTrait classTrait'.
self assert: (definition baseTrait == existing).
self assert: definition baseTrait isClass not.
self assert: definition baseTrait isMetaclass not.
self assert: definition baseTrait isTrait.
self assert: definition baseTrait isMetaclassTrait not.
self assert: definition baseTrait name equals: #SomeTrait.
]
{ #category : #running }
RGEnsureTraitTest >> testClassTraitIfTraitAlreadyExists [
"test creation of named class trait if a related trait already exists"
| existing |
existing := (environment ensureTraitNamed: 'SomeTrait') classTrait.
self assert: (existing isMetaclassTrait).
self assert: (existing isRingResolved not).
definition := environment ensureTraitNamed: 'SomeTrait classTrait'.
self assert: (definition == existing).
self assert: definition isClass not.
self assert: definition isMetaclass not.
self assert: definition isTrait.
self assert: definition isMetaclassTrait.
self assert: definition baseTrait name equals: #SomeTrait.
]
{ #category : #running }
RGEnsureTraitTest >> testTrait [
"test creation of named trait on empty environment"
definition := environment ensureTraitNamed: 'SomeTrait'.
self assert: definition isClass not.
self assert: definition isMetaclass not.
self assert: definition isTrait.
self assert: definition isMetaclassTrait not.
]
{ #category : #running }
RGEnsureTraitTest >> testTraitIfClassAlreadyExists [
"test creation of named trait if a class of the realted name already exists"
| existing |
existing := (environment ensureClassNamed: 'SomeTrait').
self assert: (existing isClass).
self assert: (existing isRingResolved).
definition := environment ensureTraitNamed: 'SomeTrait'.
self assert: (definition == existing).
self assert: definition isClass not.
self assert: definition isMetaclass not.
self assert: definition isTrait.
self assert: definition isMetaclassTrait not.
]
{ #category : #running }
RGEnsureTraitTest >> testTraitIfClassTraitAlreadyExists [
"test creation of named trait if a related class trait already exists"
| existing |
existing := (environment ensureTraitNamed: 'SomeTrait classTrait') baseTrait.
self assert: (existing isTrait).
self assert: (existing isRingResolved not).
definition := environment ensureTraitNamed: 'SomeTrait'.
self assert: (definition == existing).
self assert: definition isClass not.
self assert: definition isMetaclass not.
self assert: definition isTrait.
self assert: definition isMetaclassTrait not.
]