From 4002d76485ba4d7ff7effb9ee66070dea714ba7f Mon Sep 17 00:00:00 2001 From: Pierre Laborde <49183340+labordep@users.noreply.github.com> Date: Mon, 25 Sep 2023 21:22:52 +0200 Subject: [PATCH 1/2] Update test to check if the "dirty type" is realy dirty. --- Molecule-Tests/MolDirtyComponentTest.class.st | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Molecule-Tests/MolDirtyComponentTest.class.st b/Molecule-Tests/MolDirtyComponentTest.class.st index 5f3e70c2..3bfb22a3 100644 --- a/Molecule-Tests/MolDirtyComponentTest.class.st +++ b/Molecule-Tests/MolDirtyComponentTest.class.st @@ -51,10 +51,27 @@ MolDirtyComponentTest >> testDirtyTypeWithInstanceVariableInsteadOfComponentTrai MolComponentFactory createComponentForType: MolDirtyType named: self generatedDirtyTypeImplementationSymbol in: self generationTag. component := self class environment at: self generatedDirtyTypeImplementationSymbol. + "Check if the ComponentType is dirty" + self assert: MolDirtyType producedComponentEvents size equals: 1. + self assert: MolDirtyType producedComponentEvents first equals: nil. + self assert: MolDirtyType consumedComponentEvents size equals: 1. + self assert: MolDirtyType consumedComponentEvents first equals: nil. + self assert: MolDirtyType providedComponentParameters size equals: 1. + self assert: MolDirtyType providedComponentParameters first equals: nil. + self assert: MolDirtyType providedComponentServices size equals: 1. + self assert: MolDirtyType providedComponentServices first equals: nil. + self assert: MolDirtyType usedComponentParameters size equals: 1. + self assert: MolDirtyType usedComponentParameters first equals: nil. + self assert: MolDirtyType usedComponentServices size equals: 1. + self assert: MolDirtyType usedComponentServices first equals: nil. + self assert: (MolDirtyType class slotNames first) equals: #anInstanceVariable. + + "Check no generation of non necessary methods" self deny: (component methodDictionary includesKey: #getnilSubscriber). self deny: (component methodDictionary includesKey: #getnilNotifier). self deny: (component methodDictionary includesKey: #getnilProvider). + "Check that the contract is empty despite class side var in the all contract interfaces" self assert: component allConsumedEvents isEmpty. self assert: component allProducedEvents isEmpty. self assert: component allProvidedServices isEmpty. From 3ae754b3057d35652629bcd24cff13418e9dd77e Mon Sep 17 00:00:00 2001 From: Pierre Laborde <49183340+labordep@users.noreply.github.com> Date: Mon, 25 Sep 2023 21:37:39 +0200 Subject: [PATCH 2/2] --- Molecule-Tests/MolDirtyComponentTest.class.st | 2 +- Molecule-Tests/MolDirtyType.trait.st | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 Molecule-Tests/MolDirtyType.trait.st diff --git a/Molecule-Tests/MolDirtyComponentTest.class.st b/Molecule-Tests/MolDirtyComponentTest.class.st index f90bf72e..3bfb22a3 100644 --- a/Molecule-Tests/MolDirtyComponentTest.class.st +++ b/Molecule-Tests/MolDirtyComponentTest.class.st @@ -79,4 +79,4 @@ MolDirtyComponentTest >> testDirtyTypeWithInstanceVariableInsteadOfComponentTrai self assert: component allProvidedParameters isEmpty. self assert: component allUsedParameters isEmpty. -] \ No newline at end of file +] diff --git a/Molecule-Tests/MolDirtyType.trait.st b/Molecule-Tests/MolDirtyType.trait.st new file mode 100644 index 00000000..1515dcc1 --- /dev/null +++ b/Molecule-Tests/MolDirtyType.trait.st @@ -0,0 +1,49 @@ +" +This Type have a wrong writted contract with variables instead of Traits +" +Trait { + #name : #MolDirtyType, + #classInstVars : [ + 'anInstanceVariable' + ], + #traits : 'MolComponentType', + #classTraits : 'MolComponentType classTrait', + #category : #'Molecule-Tests-Resources - Contracts' +} + +{ #category : #'accessing - events' } +MolDirtyType classSide >> consumedComponentEvents [ + + + ^ { anInstanceVariable } +] + +{ #category : #'accessing - events' } +MolDirtyType classSide >> producedComponentEvents [ + + ^ {anInstanceVariable} +] + +{ #category : #'accessing - parameters' } +MolDirtyType classSide >> providedComponentParameters [ + + ^ {anInstanceVariable} +] + +{ #category : #'accessing - services' } +MolDirtyType classSide >> providedComponentServices [ + + ^ {anInstanceVariable} +] + +{ #category : #'accessing - parameters' } +MolDirtyType classSide >> usedComponentParameters [ + + ^ {anInstanceVariable} +] + +{ #category : #'accessing - services' } +MolDirtyType classSide >> usedComponentServices [ + + ^ {anInstanceVariable} +]