Skip to content

Commit

Permalink
Merge pull request #779 from moosetechnology/display-full
Browse files Browse the repository at this point in the history
Add #displayFullString to have an equivalent of #mooseName also usefu…
  • Loading branch information
jecisc authored Jun 3, 2024
2 parents 6203235 + c5d341b commit 0d2bcab
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Famix-Traits/FamixTAssociation.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ FamixTAssociation >> asAssociationTo: anEntity [
^ self
]

{ #category : #printing }
FamixTAssociation >> displayFullStringOn: aStream [

self source displayFullStringOn: aStream.
aStream nextPutAll: ' -> '.
self target displayFullStringOn: aStream
]

{ #category : #printing }
FamixTAssociation >> displayStringOn: aStream [

Expand Down
17 changes: 17 additions & 0 deletions src/Famix-Traits/FamixTInvocation.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ FamixTInvocation >> candidates: anObject [
candidates value: anObject
]

{ #category : #printing }
FamixTInvocation >> displayFullStringOn: aStream [

self sender
ifNotNil: [ self sender displayFullStringOn: aStream ]
ifNil: [ aStream nextPut: $? ].
aStream nextPutAll: ' -> '.
self receiver
ifNotNil: [ :rcvr | self receiver displayFullStringOn: aStream ]
ifNil: [ aStream nextPut: $? ].
aStream nextPutAll: '.'.

self signature
ifNotNil: [ aStream nextPutAll: (self signature truncateWithElipsisTo: 40) ]
ifNil: [ aStream nextPutAll: ' ? ' ]
]

{ #category : #printing }
FamixTInvocation >> displayStringOn: aStream [

Expand Down
12 changes: 12 additions & 0 deletions src/Moose-Core/MooseObject.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,18 @@ MooseObject >> description: text [
self attributeAt: #privateDescription put: text
]

{ #category : #printing }
MooseObject >> displayFullString [
"Return a name corresponding to the moose name but also for the associations instead of returning #noname"

^ String streamContents: [ :stream | self displayFullStringOn: stream ]
]

{ #category : #printing }
MooseObject >> displayFullStringOn: aStream [
self mooseNameOn: aStream
]

{ #category : #printing }
MooseObject >> displayStringOn: aStream [
self mooseNameOn: aStream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,15 @@ FamixReferenceModelImporterTest >> testConstantMethodAnnotation [
self assert: method isConstant
]

{ #category : #tests }
FamixReferenceModelImporterTest >> testDisplayFullString [
"Smoke test for #displayFullString"

self shouldnt: [ self model entities do: [ :entity | entity displayFullString ] ] raise: Error.

self assertEmpty: ((self model entities select: [ :entity | entity isAssociation ]) select: [ :asso | asso displayFullString = #noname ])
]

{ #category : #tests }
FamixReferenceModelImporterTest >> testExtendedClasses [
| subRootModelTwo p1 p2 subRootModelThree extensionMethod |
Expand Down

0 comments on commit 0d2bcab

Please sign in to comment.