Skip to content

Commit

Permalink
Merge pull request #98 from OpenSmock/Issue_0094_pharo11
Browse files Browse the repository at this point in the history
Fix tag bug while saving (#94)
  • Loading branch information
labordep authored Oct 10, 2023
2 parents 539e101 + 6b26bb0 commit 0855f0f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 8 deletions.
19 changes: 15 additions & 4 deletions src/Pyramid-Bloc/PyramidSaveModelVerifier.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,20 @@ PyramidSaveModelVerifier class >> classPackageIsEqual [
verifyBlock: [ :model |
self class environment
at: model savingClassName asSymbol
ifPresent: [ :class |
class package name = model savingPackageName ]
ifPresent: [ :class | "
Model = class package >> OK
Model = class package '-' class packageTag >> OK
KO"
class package name = model savingPackageName
ifTrue: [ true ]
ifFalse: [
class package classTags
detect: [ :tag | tag includesClass: class ]
ifFound: [ :tag |
class package name , '-' , tag name
= model savingPackageName ]
ifNone: [ false ].
] ]
ifAbsent: [ true ] ];
showBlock: [ :view | view showClassPackageIsNotEqualError ];
yourself
Expand Down Expand Up @@ -57,8 +69,7 @@ PyramidSaveModelVerifier class >> packageIsValid [

^ self new
verifyBlock: [ :model |
($- split: model savingPackageName) allSatisfy: [ :each |
each isValidGlobalName ] ];
($- split: model savingPackageName) first isValidGlobalName ];
showBlock: [ :view | view showPackageIsNotValidError ];
yourself
]
Expand Down
34 changes: 30 additions & 4 deletions src/Pyramid-Tests/PyramidSavingServiceTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ PyramidSavingServiceTest >> testCanSave [
model savingClassName: 'PyramidSavingClass'.
model savingMethodName: 'aPyramidSavingMethod'.
model savingPackageName: 'PyramidSavingPackage-abc'.
self deny: self savingService canSave.
self assert: self savingService canSave.

model savingClassName: 'PyramidSavingClass'.
model savingMethodName: 'aPyramidSavingMethod'.
Expand All @@ -107,7 +107,20 @@ PyramidSavingServiceTest >> testCanSave [

model savingClassName: self savingClass name.
model savingMethodName: 'aPyramidSavingMethod'.
model savingPackageName: self savingClass package name , 'notTheSame'.
model savingPackageName:
self savingClass package name , '-cases-plugin-save'.
self assert: self savingService canSave.

model savingClassName: self savingClass name.
model savingMethodName: 'aPyramidSavingMethod'.
model savingPackageName:
self savingClass package name , 'notTheSamePackage'.
self deny: self savingService canSave.

model savingClassName: self savingClass name.
model savingMethodName: 'aPyramidSavingMethod'.
model savingPackageName:
self savingClass package name , '-notTheSameTag'.
self deny: self savingService canSave
]

Expand All @@ -129,7 +142,10 @@ PyramidSavingServiceTest >> testSave [
Save on class side.
Assert the method is present class side.
Save on instance side.
Assert the method is present instance side."
Assert the method is present instance side.
Save with package + tag.
Assert method is present."

| model |
model := PyramidSaveModel new.
Expand Down Expand Up @@ -159,7 +175,17 @@ PyramidSavingServiceTest >> testSave [
self deny:
(self savingClass classSide canUnderstand: #instanceMethod).
self assert:
(self savingClass instanceSide canUnderstand: #instanceMethod)
(self savingClass instanceSide canUnderstand: #instanceMethod).

model onClass.
model savingPackageName:
self savingClass package name , '-cases-plugin-save'.
model savingMethodName: 'packageWithTag'.
self savingService save.
self assert:
(self savingClass classSide canUnderstand: #packageWithTag).
self deny:
(self savingClass instanceSide canUnderstand: #packageWithTag)
]

{ #category : #tests }
Expand Down

0 comments on commit 0855f0f

Please sign in to comment.