Skip to content

Commit

Permalink
When adding a talent it should also add the class side trait.
Browse files Browse the repository at this point in the history
  • Loading branch information
tesonep committed Jul 18, 2019
1 parent b413008 commit 7668f9b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Talents-Tests/TaAbstractTalentTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ Class {
'taTalentWithASlot',
'taTalentWithASlotInitialized',
'taAnotherInitializedSlot',
'createdClasses'
'createdClasses',
'taTalentWithClassSide'
],
#category : 'Talents-Tests'
#category : #'Talents-Tests'
}

{ #category : #'as yet unclassified' }
Expand Down Expand Up @@ -85,6 +86,11 @@ TaAbstractTalentTest >> setUp [
anotherSlot := 93.
'.

taTalentWithClassSide := self newTalent: #TaTalentWithClassSide with: #().
taTalentWithClassSide class compile: '
aClassMessage
^ 42
'.
]

{ #category : #running }
Expand Down
12 changes: 12 additions & 0 deletions src/Talents-Tests/TaSimpleTalentTests.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ TaSimpleTalentTests >> testAddingSimpleTrait [
self deny: (Object canUnderstand: #someMessage).
]

{ #category : #'tests-talents' }
TaSimpleTalentTests >> testClassSideMethods [
| x |
x := TaTestClassWithInstanceVariable new.
x anInstanceVariable: 23.

x addTalent: taTalentWithClassSide.

self assert: x class aClassMessage equals: 42.

]

{ #category : #'tests-talents' }
TaSimpleTalentTests >> testCopyingObjectState [
| x |
Expand Down
1 change: 1 addition & 0 deletions src/Talents/TalentInstaller.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ TalentInstaller >> extendClass: aClass with: aTalent [
builder
superclass: aClass;
traitComposition: aTalent;
classTraitComposition: aTalent classComposition;
layoutClass: aClass classLayout class ].

talentedClasses at: newClass put: aTalent.
Expand Down

0 comments on commit 7668f9b

Please sign in to comment.