Skip to content

Commit

Permalink
Improve formating
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed Jun 14, 2024
1 parent c5684c8 commit 5e6f90c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 73 deletions.
71 changes: 22 additions & 49 deletions src/Famix-Diff-Core-Tests/FamixDiffEntitiesIdentityTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ FamixDiffEntitiesIdentityTest >> testIdentityMatchClassParentIsNil [
FamixDiffEntitiesIdentityTest >> testIdentityMatchClassSame [
"setup: create changes for parents"

self
createChange: FamixUnchangedChange
with: (self baseEntityNamed: 'Famix-Diff-TestResource-P2')
and: (self targetEntityNamed: 'Famix-Diff-TestResource-P2').
self createChange: FamixUnchangedChange with: (self baseEntityNamed: 'Famix-Diff-TestResource-P2') and: (self targetEntityNamed: 'Famix-Diff-TestResource-P2').
self assert: ((self baseEntityNamed: 'Smalltalk::A3diff') identityMatch: (self targetEntityNamed: 'Smalltalk::A3diff') resolver: self resolver).
self assert: ((self targetEntityNamed: 'Smalltalk::A3diff') identityMatch: (self baseEntityNamed: 'Smalltalk::A3diff') resolver: self resolver)
]
Expand All @@ -62,39 +59,23 @@ FamixDiffEntitiesIdentityTest >> testIdentityMatchMethod [

self createChange: FamixUnchangedChange with: (self baseEntityNamed: 'Smalltalk::A3diff') and: (self targetEntityNamed: 'Smalltalk::A3diff').
self createChange: FamixRemovalChange with: (self baseEntityNamed: 'Smalltalk::A4diff').
self assert:
((self baseEntityNamed: 'Smalltalk::A3diff.c3()') identityMatch: (self targetEntityNamed: 'Smalltalk::A3diff.c3()') resolver: self resolver).
self assert:
((self targetEntityNamed: 'Smalltalk::A3diff.c3()') identityMatch: (self baseEntityNamed: 'Smalltalk::A3diff.c3()') resolver: self resolver).
self deny:
((self baseEntityNamed: 'Smalltalk::A3diff.c3()') identityMatch: (self targetEntityNamed: 'Smalltalk::A3diff.b2()') resolver: self resolver).
self deny:
((self targetEntityNamed: 'Smalltalk::A3diff.b3()') identityMatch: (self baseEntityNamed: 'Smalltalk::A3diff.c3()') resolver: self resolver).
self deny:
((self baseEntityNamed: 'Smalltalk::A3diff.c3()') identityMatch: (self targetEntityNamed: 'Smalltalk::B3diff.c3()') resolver: self resolver).
self deny:
((self targetEntityNamed: 'Smalltalk::B3diff.c3()') identityMatch: (self baseEntityNamed: 'Smalltalk::A3diff.c3()') resolver: self resolver)
self assert: ((self baseEntityNamed: 'Smalltalk::A3diff.c3()') identityMatch: (self targetEntityNamed: 'Smalltalk::A3diff.c3()') resolver: self resolver).
self assert: ((self targetEntityNamed: 'Smalltalk::A3diff.c3()') identityMatch: (self baseEntityNamed: 'Smalltalk::A3diff.c3()') resolver: self resolver).
self deny: ((self baseEntityNamed: 'Smalltalk::A3diff.c3()') identityMatch: (self targetEntityNamed: 'Smalltalk::A3diff.b2()') resolver: self resolver).
self deny: ((self targetEntityNamed: 'Smalltalk::A3diff.b3()') identityMatch: (self baseEntityNamed: 'Smalltalk::A3diff.c3()') resolver: self resolver).
self deny: ((self baseEntityNamed: 'Smalltalk::A3diff.c3()') identityMatch: (self targetEntityNamed: 'Smalltalk::B3diff.c3()') resolver: self resolver).
self deny: ((self targetEntityNamed: 'Smalltalk::B3diff.c3()') identityMatch: (self baseEntityNamed: 'Smalltalk::A3diff.c3()') resolver: self resolver)
]

{ #category : #tests }
FamixDiffEntitiesIdentityTest >> testIdentityMatchPackage [

self assert:
((self baseEntityNamed: 'Famix-Diff-TestResource-P2')
identityMatch: (self targetEntityNamed: 'Famix-Diff-TestResource-P2')
resolver: self resolver).
((self baseEntityNamed: 'Famix-Diff-TestResource-P2') identityMatch: (self targetEntityNamed: 'Famix-Diff-TestResource-P2') resolver: self resolver).
self assert:
((self targetEntityNamed: 'Famix-Diff-TestResource-P2')
identityMatch: (self baseEntityNamed: 'Famix-Diff-TestResource-P2')
resolver: self resolver).
self deny:
((self baseEntityNamed: 'Famix-Diff-TestResource-P2')
identityMatch: (self targetEntityNamed: 'Famix-Diff-TestResource-P1')
resolver: self resolver).
self deny:
((self targetEntityNamed: 'Famix-Diff-TestResource-P1')
identityMatch: (self baseEntityNamed: 'Famix-Diff-TestResource-P2')
resolver: self resolver)
((self targetEntityNamed: 'Famix-Diff-TestResource-P2') identityMatch: (self baseEntityNamed: 'Famix-Diff-TestResource-P2') resolver: self resolver).
self deny: ((self baseEntityNamed: 'Famix-Diff-TestResource-P2') identityMatch: (self targetEntityNamed: 'Famix-Diff-TestResource-P1') resolver: self resolver).
self deny: ((self targetEntityNamed: 'Famix-Diff-TestResource-P1') identityMatch: (self baseEntityNamed: 'Famix-Diff-TestResource-P2') resolver: self resolver)
]

{ #category : #tests }
Expand Down Expand Up @@ -127,36 +108,28 @@ FamixDiffEntitiesIdentityTest >> testIdentityMatchStubs [
self deny: (basA3c3 identityMatch: tgtB3c3 resolver: self resolver).
self createChange: FamixUnchangedChange with: basA3c3 and: tgtA3c3.
self assert: (basA3c3toto identityMatch: tgtA3c3toto resolver: self resolver).
self assert: ((self targetEntityNamed: 'Smalltalk::A3diff.c3().toto')
identityMatch: (self baseEntityNamed: 'Smalltalk::A3diff.c3().toto')
resolver: self resolver)
self assert:
((self targetEntityNamed: 'Smalltalk::A3diff.c3().toto') identityMatch: (self baseEntityNamed: 'Smalltalk::A3diff.c3().toto') resolver: self resolver)
]

{ #category : #tests }
FamixDiffEntitiesIdentityTest >> testIdentityMatchVariable [
"setup: create changes for parents"

self
createChange: FamixUnchangedChange
with: (self baseEntityNamed: 'Smalltalk::A3diff.c3()')
and: (self targetEntityNamed: 'Smalltalk::A3diff.c3()').
self createChange: FamixUnchangedChange with: (self baseEntityNamed: 'Smalltalk::A3diff.c3()') and: (self targetEntityNamed: 'Smalltalk::A3diff.c3()').
self createChange: FamixRemovalChange with: (self baseEntityNamed: 'Smalltalk::A4diff').

"testing variable 'toto'"
self assert: ((self baseEntityNamed: 'Smalltalk::A3diff.c3().toto')
identityMatch: (self targetEntityNamed: 'Smalltalk::A3diff.c3().toto')
resolver: self resolver).
self assert: ((self targetEntityNamed: 'Smalltalk::A3diff.c3().toto')
identityMatch: (self baseEntityNamed: 'Smalltalk::A3diff.c3().toto')
resolver: self resolver).
self assert:
((self baseEntityNamed: 'Smalltalk::A3diff.c3().toto') identityMatch: (self targetEntityNamed: 'Smalltalk::A3diff.c3().toto') resolver: self resolver).
self assert:
((self targetEntityNamed: 'Smalltalk::A3diff.c3().toto') identityMatch: (self baseEntityNamed: 'Smalltalk::A3diff.c3().toto') resolver: self resolver).

"testing variable 'toto' against 'var2'"
self deny: ((self baseEntityNamed: 'Smalltalk::A3diff.c3().toto')
identityMatch: (self targetEntityNamed: 'Smalltalk::A3diff.c3().var2')
resolver: self resolver).
self deny: ((self targetEntityNamed: 'Smalltalk::A3diff.c3().var2')
identityMatch: (self baseEntityNamed: 'Smalltalk::A3diff.c3().toto')
resolver: self resolver).
self deny:
((self baseEntityNamed: 'Smalltalk::A3diff.c3().toto') identityMatch: (self targetEntityNamed: 'Smalltalk::A3diff.c3().var2') resolver: self resolver).
self deny:
((self targetEntityNamed: 'Smalltalk::A3diff.c3().var2') identityMatch: (self baseEntityNamed: 'Smalltalk::A3diff.c3().toto') resolver: self resolver).

"testing variables 'toto'"
self deny: ((self baseEntityNamed: 'Smalltalk::A3diff.c3().toto')
Expand Down
11 changes: 3 additions & 8 deletions src/Famix-Diff-Core-Tests/FamixDiffEntitiesMoveTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ Class {
{ #category : #tests }
FamixDiffEntitiesMoveTest >> testMoveMatchClass [

self
createChange: FamixUnchangedChange
with: (self baseEntityNamed: 'Famix-Diff-TestResource-P2')
and: (self targetEntityNamed: 'Famix-Diff-TestResource-P2').
self createChange: FamixUnchangedChange with: (self baseEntityNamed: 'Famix-Diff-TestResource-P2') and: (self targetEntityNamed: 'Famix-Diff-TestResource-P2').
self createChange: FamixAddChange with: (self baseEntityNamed: 'Famix-Diff-TestResource-P1'). "changing package of A3 in target model"
(self targetEntityNamed: 'Smalltalk::A3diff') parentPackage: (self targetEntityNamed: 'Famix-Diff-TestResource-P1').
self assert: ((self baseEntityNamed: 'Smalltalk::A3diff') moveMatch: (self targetEntityNamed: 'Smalltalk::A3diff') resolver: self resolver).
Expand All @@ -22,10 +19,8 @@ FamixDiffEntitiesMoveTest >> testMoveMatchMethod [
"moving c3 metod"

(self targetEntityNamed: 'Smalltalk::A3diff.c3()') parentType: (self targetEntityNamed: 'Smalltalk::A2diff').
self assert:
((self baseEntityNamed: 'Smalltalk::A3diff.c3()') moveMatch: (self targetEntityNamed: 'Smalltalk::A2diff.c3()') resolver: self resolver).
self assert:
((self targetEntityNamed: 'Smalltalk::A2diff.c3()') moveMatch: (self baseEntityNamed: 'Smalltalk::A3diff.c3()') resolver: self resolver)
self assert: ((self baseEntityNamed: 'Smalltalk::A3diff.c3()') moveMatch: (self targetEntityNamed: 'Smalltalk::A2diff.c3()') resolver: self resolver).
self assert: ((self targetEntityNamed: 'Smalltalk::A2diff.c3()') moveMatch: (self baseEntityNamed: 'Smalltalk::A3diff.c3()') resolver: self resolver)
]

{ #category : #tests }
Expand Down
22 changes: 6 additions & 16 deletions src/Famix-Diff-Core-Tests/FamixDiffEntitiesRenameTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ Class {
FamixDiffEntitiesRenameTest >> testRenameMatchClass [

(self targetEntityNamed: 'Smalltalk::A3diff') name: 'X3diff'.
self
createChange: FamixUnchangedChange
with: (self baseEntityNamed: 'Famix-Diff-TestResource-P2')
and: (self targetEntityNamed: 'Famix-Diff-TestResource-P2').
self createChange: FamixUnchangedChange with: (self baseEntityNamed: 'Famix-Diff-TestResource-P2') and: (self targetEntityNamed: 'Famix-Diff-TestResource-P2').
self assert: ((self baseEntityNamed: 'Smalltalk::A3diff') renameMatch: (self targetEntityNamed: 'Smalltalk::X3diff') resolver: self resolver).
self assert: ((self targetEntityNamed: 'Smalltalk::X3diff') renameMatch: (self baseEntityNamed: 'Smalltalk::A3diff') resolver: self resolver)
]
Expand All @@ -23,20 +20,16 @@ FamixDiffEntitiesRenameTest >> testRenameMatchMethod [
"Note: does not change the mooseName, so we still look for it later using 'Smalltalk::B3diff.c3()'"
(self targetEntityNamed: 'Smalltalk::B3diff.c3()') signature: 'x3()'.
self createChange: FamixUnchangedChange with: (self baseEntityNamed: 'Smalltalk::B3diff') and: (self targetEntityNamed: 'Smalltalk::B3diff').
self assert:
((self baseEntityNamed: 'Smalltalk::B3diff.c3()') renameMatch: (self targetEntityNamed: 'Smalltalk::B3diff.c3()') resolver: self resolver).
self assert:
((self targetEntityNamed: 'Smalltalk::B3diff.c3()') renameMatch: (self baseEntityNamed: 'Smalltalk::B3diff.c3()') resolver: self resolver)
self assert: ((self baseEntityNamed: 'Smalltalk::B3diff.c3()') renameMatch: (self targetEntityNamed: 'Smalltalk::B3diff.c3()') resolver: self resolver).
self assert: ((self targetEntityNamed: 'Smalltalk::B3diff.c3()') renameMatch: (self baseEntityNamed: 'Smalltalk::B3diff.c3()') resolver: self resolver)
]

{ #category : #tests }
FamixDiffEntitiesRenameTest >> testRenameMatchPackage [

(self targetEntityNamed: 'Famix-Diff-TestResource-P2') name: 'Famix-Diff-TestResource-X0'.
self assert:
((self baseEntityNamed: 'Famix-Diff-TestResource-P2') renameMatch: (self targetEntityNamed: 'Famix-Diff-TestResource-X0') resolver: self resolver).
self assert:
((self targetEntityNamed: 'Famix-Diff-TestResource-X0') renameMatch: (self baseEntityNamed: 'Famix-Diff-TestResource-P2') resolver: self resolver)
self assert: ((self baseEntityNamed: 'Famix-Diff-TestResource-P2') renameMatch: (self targetEntityNamed: 'Famix-Diff-TestResource-X0') resolver: self resolver).
self assert: ((self targetEntityNamed: 'Famix-Diff-TestResource-X0') renameMatch: (self baseEntityNamed: 'Famix-Diff-TestResource-P2') resolver: self resolver)
]

{ #category : #tests }
Expand Down Expand Up @@ -71,10 +64,7 @@ FamixDiffEntitiesRenameTest >> testRenameMatchStub [
FamixDiffEntitiesRenameTest >> testRenameMatchVariable [

| var1 var2 |
self
createChange: FamixUnchangedChange
with: (self baseEntityNamed: 'Smalltalk::A3diff.c3()')
and: (self targetEntityNamed: 'Smalltalk::A3diff.c3()'). "creating fake accesses because maching of variables depends on them
self createChange: FamixUnchangedChange with: (self baseEntityNamed: 'Smalltalk::A3diff.c3()') and: (self targetEntityNamed: 'Smalltalk::A3diff.c3()'). "creating fake accesses because maching of variables depends on them
First we don't create enough accesses (need at least 1)"
var1 := self baseEntityNamed: 'Smalltalk::A3diff.c3().toto'.
var2 := self targetEntityNamed: 'Smalltalk::A3diff.c3().var2'.
Expand Down

0 comments on commit 5e6f90c

Please sign in to comment.