author | Jan Vrany <jan.vrany@labware.com> |
Wed, 23 Dec 2020 08:46:20 +0000 | |
changeset 10 | 1fa4cd506c87 |
parent 9 | d64df1abdf2a |
permissions | -rw-r--r-- |
10
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
1 |
" |
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
2 |
COPYRIGHT (c) 2020 LabWare |
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
3 |
" |
9 | 4 |
"{ Package: 'stx:goodies/ring/core/tests' }" |
5 |
||
6 |
"{ NameSpace: Smalltalk }" |
|
7 |
||
8 |
RGTest subclass:#RGCommentTest |
|
9 |
instanceVariableNames:'' |
|
10 |
classVariableNames:'' |
|
11 |
poolDictionaries:'' |
|
12 |
category:'Ring-Tests-Core' |
|
13 |
! |
|
14 |
||
10
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
15 |
!RGCommentTest class methodsFor:'documentation'! |
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
16 |
|
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
17 |
copyright |
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
18 |
" |
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
19 |
COPYRIGHT (c) 2020 LabWare |
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
20 |
|
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
21 |
|
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
22 |
" |
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
23 |
! ! |
9 | 24 |
|
25 |
!RGCommentTest methodsFor:'tests'! |
|
26 |
||
27 |
testClass |
|
28 |
||
29 |
| environment aClass aPackage aComment | |
|
30 |
||
31 |
environment := RGEnvironment new. |
|
32 |
aClass := environment ensureClassNamed: #SomeClass. |
|
33 |
aPackage := environment ensurePackageNamed: #SomePackage. |
|
34 |
aClass package: aPackage. |
|
35 |
aComment := RGComment parent: aClass. |
|
36 |
aComment content: 'some comment'. |
|
37 |
self deny: aClass hasComment. |
|
38 |
aClass comment: aComment. |
|
39 |
self assert: aComment package equals: aPackage. |
|
40 |
self assert: aClass hasComment. |
|
41 |
||
42 |
self assert: aComment fullName equals: 'SomeClass comment'. |
|
43 |
! |
|
44 |
||
45 |
testImplicitEnvironment |
|
46 |
||
47 |
| def def2 env | |
|
48 |
||
49 |
def := RGComment unnamed. |
|
50 |
env := def environment. |
|
51 |
||
52 |
self checkImplicitSingleClassEnvironmentOf: def parent. |
|
53 |
||
54 |
self assert: (def isRingResolved). |
|
55 |
||
56 |
def2 := RGComment parent: def parent . |
|
57 |
self checkImplicitSingleClassEnvironmentOf: def parent. |
|
58 |
! |
|
59 |
||
60 |
testMakeReslolved |
|
61 |
||
62 |
| comment | |
|
63 |
||
64 |
comment := RGComment unnamed. |
|
65 |
comment makeResolved. |
|
66 |
self assert: comment unresolvedProperties isEmpty. |
|
67 |
self assert: comment content equals: ''. |
|
68 |
self assert: comment author equals: ''. |
|
10
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
69 |
self assert: (comment time isKindOf: Timestamp). |
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
70 |
|
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
71 |
"Modified: / 22-12-2020 / 20:13:04 / Jan Vrany <jan.vrany@labware.com>" |
9 | 72 |
! |
73 |
||
74 |
testNewComment |
|
75 |
| comment time | |
|
76 |
||
77 |
comment := RGComment unnamed. |
|
78 |
||
79 |
self assert: (comment isRingResolved). |
|
80 |
self assert: (comment isComment). |
|
81 |
||
82 |
self assert: (comment hasUnresolvedAll: #(content author time name)). |
|
83 |
||
84 |
self assert: (comment isEmptyOrNil). |
|
85 |
||
86 |
self assert: comment content equals: ''. |
|
87 |
comment content: 'some class comment'. |
|
88 |
self assert: (comment hasUnresolvedAll: #(author time name)). |
|
89 |
self assert: comment content equals: 'some class comment'. |
|
90 |
self deny: (comment isEmptyOrNil). |
|
91 |
self assert: comment content equals: comment sourceCode. |
|
92 |
||
93 |
self assert: comment author equals: ''. |
|
94 |
comment author: 'FullAuthorName'. |
|
95 |
self assert: (comment hasUnresolvedAll: #(time name)). |
|
96 |
self assert: comment author equals: 'FullAuthorName'. |
|
97 |
||
10
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
98 |
time := Timestamp now. |
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
99 |
self assert: comment time equals: Timestamp epoch. |
9 | 100 |
comment time: time. |
101 |
self assert: (comment hasUnresolved: #name). |
|
102 |
self assert: comment time equals: time. |
|
103 |
! |
|
104 |
||
105 |
testResolvingConsistency |
|
106 |
||
107 |
| anObject | |
|
108 |
anObject := RGComment unnamed. |
|
109 |
self checkClassesConsistency: anObject and: anObject makeResolved |
|
110 |
! |
|
111 |
||
112 |
testTransformations |
|
113 |
| comment time | |
|
114 |
||
115 |
comment := RGComment unnamed. |
|
116 |
||
117 |
self assert: (comment isRingResolved). |
|
118 |
||
119 |
self assert: (comment hasUnresolvedAll: #(content author time name)). |
|
120 |
||
121 |
self assert: comment content equals: ''. |
|
122 |
comment content: 'some class comment'. |
|
123 |
self assert: (comment hasUnresolvedAll: #(author time name)). |
|
124 |
self assert: comment content equals: 'some class comment'. |
|
125 |
||
126 |
self assert: comment author equals: ''. |
|
127 |
comment author: 'FullAuthorName'. |
|
128 |
self assert: (comment hasUnresolvedAll: #(time name)). |
|
129 |
self assert: comment author equals: 'FullAuthorName'. |
|
130 |
||
10
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
131 |
time := Timestamp now. |
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
132 |
self assert: comment time equals: Timestamp epoch. |
9 | 133 |
comment time: time. |
134 |
self assert: (comment hasUnresolved: #name). |
|
135 |
self assert: comment time equals: time. |
|
136 |
! ! |
|
137 |
||
10
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
138 |
!RGCommentTest class methodsFor:'documentation'! |
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
139 |
|
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
140 |
version_HG |
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
141 |
|
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
142 |
^ '$Changeset: <not expanded> $' |
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
143 |
! ! |
1fa4cd506c87
core: use `Timestamp` instead of (Pharo) `DateAndTime`
Jan Vrany <jan.vrany@labware.com>
parents:
9
diff
changeset
|
144 |