diff --git a/dev/src/BaselineOfExercism/BaselineOfExercism.class.st b/dev/src/BaselineOfExercism/BaselineOfExercism.class.st index 6c776065..bbc53725 100644 --- a/dev/src/BaselineOfExercism/BaselineOfExercism.class.st +++ b/dev/src/BaselineOfExercism/BaselineOfExercism.class.st @@ -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' ] ] diff --git a/dev/src/ExercismPharo120/ExercismSubmissionTest.extension.st b/dev/src/ExercismPharo120/ExercismSubmissionTest.extension.st new file mode 100644 index 00000000..bb28bb39 --- /dev/null +++ b/dev/src/ExercismPharo120/ExercismSubmissionTest.extension.st @@ -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. +] diff --git a/dev/src/ExercismPharo120/package.st b/dev/src/ExercismPharo120/package.st new file mode 100644 index 00000000..dd7630d8 --- /dev/null +++ b/dev/src/ExercismPharo120/package.st @@ -0,0 +1 @@ +Package { #name : #ExercismPharo120 } diff --git a/dev/src/ExercismTests/ExercismExerciseTest.class.st b/dev/src/ExercismTests/ExercismExerciseTest.class.st index 14fd8483..49daebe6 100644 --- a/dev/src/ExercismTests/ExercismExerciseTest.class.st +++ b/dev/src/ExercismTests/ExercismExerciseTest.class.st @@ -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 }