Skip to content

Commit

Permalink
Better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed Jul 18, 2024
1 parent 824d36e commit b90681a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
20 changes: 10 additions & 10 deletions src/Famix-Diff-Core-Tests/FamixDiffResultTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ FamixDiffResultTest >> testAdditions [
self assert: additions class equals: result class
]

{ #category : #tests }
FamixDiffResultTest >> testGroupAdditionsAndRemovalsByRoots [

| subResult |
subResult := result groupAdditionsAndRemovalsByRoots.
self assert: subResult additions size equals: 1.
self assert: subResult additions anyOne entity mooseName equals: #'Famix-Diff-TestResource-P1'.
self assert: subResult removals size equals: 3 "1 package and a pragma with its type"
]

{ #category : #tests }
FamixDiffResultTest >> testMoves [

Expand Down Expand Up @@ -60,16 +70,6 @@ FamixDiffResultTest >> testRenames [
self assert: moves class equals: result class
]

{ #category : #tests }
FamixDiffResultTest >> testWithRootAdditionsAndRemovals [

| subResult |
subResult := result withRootAdditionsAndRemovals.
self assert: subResult additions size equals: 1.
self assert: subResult additions anyOne entity mooseName equals: #'Famix-Diff-TestResource-P1'.
self assert: subResult removals size equals: 3 "1 package and a pragma with its type"
]

{ #category : #tests }
FamixDiffResultTest >> testWithoutStubs [

Expand Down
20 changes: 10 additions & 10 deletions src/Famix-Diff-Core/FamixDiffResult.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ FamixDiffResult >> entityChanges [
^ self reject: [ :change | change isForAssociation ]
]

{ #category : #accessing }
FamixDiffResult >> groupAdditionsAndRemovalsByRoots [
"When entities are not found in the base or target model we create additions and removals. This API method return a new set of changes that keeps only the top level additions and removals. If we add a package for example it will remove all its added classes methods and variables to keep a high level view of the changes."

^ self select: [ :change |
change entity isAssociation not and: [
(change isAddition and: [ change entity parents noneSatisfy: [ :parent | self additions anySatisfy: [ :change2 | change2 entity = parent ] ] ]) or: [
change isRemoval and: [ change entity parents noneSatisfy: [ :parent | self removals anySatisfy: [ :change2 | change2 entity = parent ] ] ] ] ] ]
]

{ #category : #accessing }
FamixDiffResult >> moves [

Expand Down Expand Up @@ -85,16 +95,6 @@ FamixDiffResult >> species [
^ self class
]

{ #category : #accessing }
FamixDiffResult >> withRootAdditionsAndRemovals [
"When entities are not found in the base or target model we create additions and removals. This API method return a new set of changes that keeps only the top level additions and removals. If we add a package for example it will remove all its added classes methods and variables to keep a high level view of the changes."

^ self select: [ :change |
change entity isAssociation not and: [
(change isAddition and: [ change entity parents noneSatisfy: [ :parent | self additions anySatisfy: [ :change2 | change2 entity = parent ] ] ]) or: [
change isRemoval and: [ change entity parents noneSatisfy: [ :parent | self removals anySatisfy: [ :change2 | change2 entity = parent ] ] ] ] ] ]
]

{ #category : #accessing }
FamixDiffResult >> withoutStubs [
"Returns all the results without the stubs"
Expand Down

0 comments on commit b90681a

Please sign in to comment.