Skip to content

Commit

Permalink
Fixing reflectivity tests that can randomly fail because of unstable …
Browse files Browse the repository at this point in the history
…and unpredictable tests generating methods.
  • Loading branch information
StevenCostiou committed May 6, 2024
1 parent 94539ac commit a49af14
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
13 changes: 6 additions & 7 deletions src/Reflectivity-Tests/LinkInstallerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ LinkInstallerTest >> setUp [
{ #category : 'running' }
LinkInstallerTest >> tearDown [
ReflectivityExamples2 new removeModifiedMethodWithInstVarAccess.
ReflectivityExamples2 new removeNewMethodWithInstVarAccess.
ReflectivityExamples new removeTemporaryMethods.
super tearDown
]
Expand Down Expand Up @@ -475,8 +476,7 @@ LinkInstallerTest >> testPermaLinkNotInstalledOnObjectIfExistsInClass [
link installOnVariableNamed: #instVar for: obj option: #all instanceSpecific: true.
self assert: link nodes size equals: 8.

link uninstall.
ReflectivityExamples2 new removeNewMethodWithInstVarAccess
link uninstall
]

{ #category : 'links - updating' }
Expand Down Expand Up @@ -751,8 +751,7 @@ LinkInstallerTest >> testSlotOrVarLinksAddedAfterMethodAddition [

|methodNode link|
methodNode := (ReflectivityExamples2 >> #methodWithInstVarAccess) ast.
ReflectivityExamples2 new removeNewMethodWithInstVarAccess.


link := MetaLink new.
link installOnVariableNamed: #instVar for: ReflectivityExamples2 option: #all instanceSpecific: false.

Expand All @@ -771,8 +770,7 @@ LinkInstallerTest >> testSlotOrVarLinksAddedAfterMethodAdditionForObject [

methodNode := (ReflectivityExamples2 >> #methodWithInstVarAccess) ast.
obj := ReflectivityExamples2 new.
ReflectivityExamples2 new removeNewMethodWithInstVarAccess.


link := MetaLink new.
link installOnVariableNamed: #instVar for: obj option: #all instanceSpecific: true.

Expand All @@ -787,7 +785,7 @@ LinkInstallerTest >> testSlotOrVarLinksAddedAfterMethodAdditionForObject [
{ #category : 'permalinks' }
LinkInstallerTest >> testSlotOrVarLinksRemainAfterMethodModification [
|methodNode link|

ReflectivityExamples2 new generateNewMethodWithInstVarAccess.
ReflectivityExamples2 new resetModifiedMethodWithInstVarAccess.
methodNode := (ReflectivityExamples2 >> #modifiedMethodWithInstVarAccess) ast.

Expand All @@ -808,6 +806,7 @@ LinkInstallerTest >> testSlotOrVarLinksRemainAfterMethodModificationForObject [
|methodNode link obj|

obj := ReflectivityExamples2 new.
ReflectivityExamples2 new generateNewMethodWithInstVarAccess.
ReflectivityExamples2 new resetModifiedMethodWithInstVarAccess.
methodNode := (ReflectivityExamples2 >> #modifiedMethodWithInstVarAccess) ast.

Expand Down
7 changes: 0 additions & 7 deletions src/Reflectivity-Tests/ReflectivityExamples2.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@ ReflectivityExamples2 >> modifyMethodWithInstVarAccess [
instVar > 5 ifTrue:[^ instVar raisedTo: 2]'
]

{ #category : 'example' }
ReflectivityExamples2 >> newMethodWithInstVarAccess [
instVar := 5.
instVar := 6.
instVar > 5 ifTrue:[^ instVar raisedTo: 2]
]

{ #category : 'removing' }
ReflectivityExamples2 >> removeModifiedMethodWithInstVarAccess [
self class removeSelector: #modifiedMethodWithInstVarAccess
Expand Down

0 comments on commit a49af14

Please sign in to comment.