0
|
1 |
"{ Package: 'stx:goodies/ring/tests' }"
|
|
2 |
|
|
3 |
"{ NameSpace: Smalltalk }"
|
|
4 |
|
|
5 |
TestCase subclass:#RGCommentDefinitionTest
|
|
6 |
instanceVariableNames:''
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'Ring-Core-Kernel-Tests'
|
|
10 |
!
|
|
11 |
|
|
12 |
RGCommentDefinitionTest comment:'SUnit tests for comment definitions'
|
|
13 |
!
|
|
14 |
|
|
15 |
!RGCommentDefinitionTest methodsFor:'testing'!
|
|
16 |
|
|
17 |
testActiveComment
|
|
18 |
|
|
19 |
| rgComment |
|
|
20 |
rgComment := RGCommentDefinition realClass: RGClassDefinition.
|
|
21 |
self assert: rgComment isActive.
|
|
22 |
self assert: rgComment sourcePointer isNil.
|
|
23 |
self assert: rgComment content notNil.
|
|
24 |
self assert: rgComment stamp notNil.
|
|
25 |
rgComment content: ''.
|
|
26 |
"it always reads from the organization and the previous changes was not commited"
|
|
27 |
self assert: rgComment content ~= ''.
|
|
28 |
|
|
29 |
rgComment fromActiveToPassive.
|
|
30 |
self assert: rgComment isPassive.
|
|
31 |
self assert: rgComment sourcePointer isNil.
|
|
32 |
self assert: rgComment content notNil.
|
|
33 |
self assert: rgComment stamp notNil.
|
|
34 |
rgComment content: ''.
|
|
35 |
self assert: rgComment content = ''.
|
|
36 |
|
|
37 |
rgComment := RGCommentDefinition realClass: RGClassDefinition.
|
|
38 |
rgComment fromActiveToHistorical.
|
|
39 |
self assert: rgComment isHistorical.
|
|
40 |
self assert: rgComment sourcePointer notNil.
|
|
41 |
self assert: rgComment content notNil.
|
|
42 |
self assert: rgComment stamp notNil.
|
|
43 |
rgComment content: ''.
|
|
44 |
"it always reads from the source file and the previous changes was not commited"
|
|
45 |
self assert: rgComment content ~= ''
|
|
46 |
!
|
|
47 |
|
|
48 |
testCommentFromSourceFile
|
|
49 |
| rgComment |
|
|
50 |
|
|
51 |
rgComment := (RGCommentDefinition realClass: RGClassDefinition) asHistorical.
|
|
52 |
self assert: rgComment isHistorical.
|
|
53 |
self assert: rgComment sourcePointer notNil.
|
|
54 |
self assert: rgComment content notNil.
|
|
55 |
self assert: rgComment stamp notNil
|
|
56 |
!
|
|
57 |
|
|
58 |
testCommentWithoutAuthor
|
|
59 |
| newComment |
|
|
60 |
|
|
61 |
newComment:= RGCommentDefinition new
|
|
62 |
content: 'This is a comment for test';
|
|
63 |
stamp: '3/22/2011 14:51';
|
|
64 |
yourself.
|
|
65 |
|
|
66 |
self assert: (newComment hasAuthor not).
|
|
67 |
!
|
|
68 |
|
|
69 |
testNewComment
|
|
70 |
| newComment |
|
|
71 |
|
|
72 |
newComment:= RGCommentDefinition new
|
|
73 |
content: 'This is a comment for test';
|
|
74 |
stamp: 'VeronicaUquillas 3/22/2011 14:51';
|
|
75 |
yourself.
|
|
76 |
|
|
77 |
self assert: newComment isComment.
|
|
78 |
self assert: newComment isPassive.
|
|
79 |
self assert: newComment name = #Comment.
|
|
80 |
self assert: newComment hasStamp.
|
|
81 |
self assert: newComment hasAuthor.
|
|
82 |
self assert: newComment timeStamp notNil.
|
|
83 |
|
|
84 |
self assert: (newComment author = 'VeronicaUquillas').
|
|
85 |
self assert: (newComment timeStamp = '3/22/2011 14:51' asDateAndTime).
|
|
86 |
self assert: (newComment parent = nil).
|
|
87 |
self assert: (newComment environment = Smalltalk globals).
|
|
88 |
!
|
|
89 |
|
|
90 |
testSorting
|
|
91 |
|
|
92 |
| rgComm1 rgComm2 |
|
|
93 |
rgComm1 := RGCommentDefinition realClass: RGClassDefinition.
|
|
94 |
rgComm2 := RGCommentDefinition realClass: RGElementDefinition.
|
|
95 |
self assert: rgComm1 <= rgComm2
|
|
96 |
!
|
|
97 |
|
|
98 |
testingConversion
|
|
99 |
|
|
100 |
| rgComm |
|
|
101 |
rgComm := RGCommentDefinition realClass: RGClassDefinition.
|
|
102 |
self assert: rgComm asString equals: 'RGClassDefinition Comment'.
|
|
103 |
|
|
104 |
rgComm := RGCommentDefinition class: (RGClassDefinition named: #Foo).
|
|
105 |
self assert: rgComm asString equals: 'Foo Comment'
|
|
106 |
! !
|
|
107 |
|