Skip to content

Commit

Permalink
Merge pull request #16401 from hernanmd/fix_ep_fileout_class_comments
Browse files Browse the repository at this point in the history
Add support for Epicea file out
  • Loading branch information
jecisc committed Apr 5, 2024
2 parents d58c838 + a49c74d commit e402ab9
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 11 deletions.
22 changes: 22 additions & 0 deletions src/Epicea-Tests/EpCodeChangeIntegrationTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,28 @@ EpCodeChangeIntegrationTest >> testBehaviorCommentChange [
self assert: (self countLogEventsWith: EpBehaviorCommentChange) equals: 1
]

{ #category : 'tests' }
EpCodeChangeIntegrationTest >> testBehaviorCommentChangeWithoutStamp [

| newClass |
self assert: (self countLogEventsWith: EpBehaviorCommentChange) equals: 0.

newClass := classFactory newClass.
newClass comment: 'This is a comment'.
self assert: (self countLogEventsWith: EpBehaviorCommentChange) equals: 1
]

{ #category : 'tests' }
EpCodeChangeIntegrationTest >> testBehaviorNameChange [

| newClass |
self assert: (self countLogEventsWith: EpBehaviorNameChange) equals: 0.

newClass := classFactory newClass.
newClass rename: #AnotherClassNameForTesting1.
self assert: (self countLogEventsWith: EpBehaviorNameChange) equals: 1
]

{ #category : 'tests' }
EpCodeChangeIntegrationTest >> testClassAddition [

Expand Down
11 changes: 11 additions & 0 deletions src/Epicea/EpBehaviorCommentChange.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ EpBehaviorCommentChange >> behaviorAffectedName [
^ behavior name
]

{ #category : 'accessing' }
EpBehaviorCommentChange >> fileOutEntryOn: aWriteStream [

aWriteStream
nextPutAll: '(self class environment at: #';
nextPutAll: self behaviorAffectedName;
nextPutAll: ') comment: ';
nextChunkPut: self newComment surroundedBySingleQuotes;
cr
]

{ #category : 'initialization' }
EpBehaviorCommentChange >> initializeWithBehavior: aBehavior oldComment: anOldComment newComment: aNewComment oldStamp: anOldStamp newStamp: aNewStamp [

Expand Down
11 changes: 11 additions & 0 deletions src/Epicea/EpBehaviorNameChange.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ EpBehaviorNameChange >> classAffected [
^ behavior
]

{ #category : 'accessing' }
EpBehaviorNameChange >> fileOutEntryOn: aWriteStream [

aWriteStream
nextPutAll: '(self class environment at: #';
nextPutAll: self oldName;
nextPutAll: ') rename: ';
nextChunkPut: self newName;
cr
]

{ #category : 'initialization' }
EpBehaviorNameChange >> initializeOldName: anOldName newName: aNewName class: aBehavior [

Expand Down
13 changes: 7 additions & 6 deletions src/Epicea/EpClassModification.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ EpClassModification >> behaviorAffectedName [
EpClassModification >> fileOutEntryOn: aWriteStream [
"Write out class definition for the given class on the given stream, if the class definition was added or changed."

| realClass |

realClass := self newClass realClass.
aWriteStream
nextChunkPut: realClass definitionString;
cr.
| defString |
defString := self newClass realClass
ifNotNil: [ : realClass | realClass definitionString ]
ifNil: [ self newClass definitionSource ].

aWriteStream
nextChunkPut: defString;
cr
]

{ #category : 'testing' }
Expand Down
10 changes: 5 additions & 5 deletions src/Epicea/TestCase.extension.st
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Extension { #name : 'TestCase' }

{ #category : '*Epicea' }
TestCase >> shouldLogWithEpicea [
TestCase class >> shouldLogWithEpicea [
"When running a test, we disable the loggings of Epicea to run the tests silently. In case a TestCase explicitly wants to Epicea logs, then I can be overriden to return true and enable the logs."

^ self class shouldLogWithEpicea
^ false
]

{ #category : '*Epicea' }
TestCase class >> shouldLogWithEpicea [
"When running a test, we disable the loggings of Epicea to run the tests silently. In case a TestCase explicitly wants to Epicea logs, then I can be overriden to return true and enable the logs."
TestCase >> shouldLogWithEpicea [

^ false
^ self class shouldLogWithEpicea
]

0 comments on commit e402ab9

Please sign in to comment.