Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added compatibility package for P12. Moved P12 version dependent meth…
Browse files Browse the repository at this point in the history
…ods to this package.
Bajger committed Feb 14, 2024
1 parent 673dec3 commit 07edef3
Showing 4 changed files with 112 additions and 3 deletions.
5 changes: 5 additions & 0 deletions dev/src/BaselineOfExercism/BaselineOfExercism.class.st
Original file line number Diff line number Diff line change
@@ -67,6 +67,11 @@ BaselineOfExercism >> baseline: spec [
group: 'testRunner' with: #('ExercismTestRunner');
group: 'testRunnerTests' with: #('ExercismTestRunnerTests'), self class exerciseGoldenTestPackageNames;
group: 'v3' with: #('ExercismV3')
].
spec for: #'pharo12.x' do: [
"ExercismTools methods will be overwritten by compatibility package for Pharo 12"
spec package: 'ExercismTools' with: [ spec includes: #('ExercismPharo120') ].
spec package: 'ExercismPharo120'
]
]

103 changes: 103 additions & 0 deletions dev/src/ExercismPharo120/ExercismSubmissionTest.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
Extension { #name : #ExercismSubmissionTest }

{ #category : #'*ExercismPharo120' }
ExercismSubmissionTest class >> mockSnapshotSTON [
^ 'MCSnapshot {
#definitions : OrderedCollection [
MCOrganizationDefinition {
#packageName : #''Exercise@DependencyMock'',
#tagNames : [ ]
},
MCMethodDefinition {
#classIsMeta : false,
#source : ''mockMethod ^ \''Call from class: \'', self class name'',
#category : #''as yet unclassified'',
#selector : #mockMethod,
#className : #CMock
},
MCMethodDefinition {
#classIsMeta : false,
#source : ''mockMethod ^ CMock mockMethod'',
#category : #''as yet unclassified'',
#selector : #mockMethod,
#className : #BMock
},
MCMethodDefinition {
#classIsMeta : false,
#source : ''mockMethod ^ BMock mockMethod'',
#category : #''as yet unclassified'',
#selector : #mockMethod,
#className : #AMock
},
MCClassDefinition {
#name : #CMock,
#superclassName : #Object,
#variables : OrderedCollection [ ],
#packageName : #''Exercise@DependencyMock'',
#type : #normal,
#comment : '''',
#commentStamp : '''',
#traitComposition : ''{}'',
#classTraitComposition : ''{}''
},
MCClassDefinition {
#name : #BMock,
#superclassName : #CMock,
#variables : OrderedCollection [ ],
#packageName : #''Exercise@DependencyMock'',
#type : #normal,
#comment : '''',
#commentStamp : '''',
#traitComposition : ''{}'',
#classTraitComposition : ''{}''
},
MCClassDefinition {
#name : #AMock,
#superclassName : #BMock,
#variables : OrderedCollection [ ],
#packageName : #''Exercise@DependencyMock'',
#type : #normal,
#comment : '''',
#commentStamp : '''',
#traitComposition : ''{}'',
#classTraitComposition : ''{}''
}
],
#classDefinitionCache : {
#AMock : @12,
#CMock : @8,
#BMock : @10
}
}'
]

{ #category : #'*ExercismPharo120' }
ExercismSubmissionTest class >> prepareMockPackageWithDependentClasses [
" this is used for generating STON representation of MCSnapshot (see class side method), we don't need to create classes during test"
|aClass bClass cClass aPackage|

cClass := Object << #CMock
slots: {};
sharedVariables: {};
package: 'Exercise@DependencyMock';
install.

bClass := (self class environment at: #CMock) << #BMock
slots: {};
sharedVariables: {};
package: 'Exercise@DependencyMock';
install.

aClass := (self class environment at: #BMock) << #AMock
slots: {};
sharedVariables: {};
package: 'Exercise@DependencyMock';
install.

aClass compile: 'mockMethod ^ BMock mockMethod'.
bClass compile: 'mockMethod ^ CMock mockMethod'.
cClass compile: 'mockMethod ^ ''Call from class: '', self class name'.

aPackage := PackageOrganizer default packageNamed: 'Exercise@DependencyMock'.
^ TonelWriter new toSTON: aPackage snapshot.
]
1 change: 1 addition & 0 deletions dev/src/ExercismPharo120/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #ExercismPharo120 }
6 changes: 3 additions & 3 deletions dev/src/ExercismTests/ExercismExerciseTest.class.st
Original file line number Diff line number Diff line change
@@ -163,9 +163,9 @@ ExercismExerciseTest >> testSolutionSources [

self assertCollection: sources keys asSet equals: classNames asSet.

(sources at: classNames last) should includeSubstring: 'Tested on:'.
(sources at: classNames first) should includeSubstring: '#name : #', classes first name.
(sources at: classNames allButLast last) should includeSubstring: '#name : #', classes last name.
(sources at: classNames last) includesSubstring: 'Tested on:'.
(sources at: classNames first) includesSubstring: '#name : #', classes first name.
(sources at: classNames allButLast last) includesSubstring: '#name : #', classes last name.
]

{ #category : #tests }

0 comments on commit 07edef3

Please sign in to comment.