Skip to content

Commit 42f3eeb

Browse files
authoredMar 25, 2019
Merge pull request #217 from macta/publish-test-results
Publish test results
2 parents 975356d + cad5af6 commit 42f3eeb

6 files changed

+38
-7
lines changed
 

‎dev/src/ExercismTests/ExercismExerciseTest.class.st

+3-2
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,12 @@ ExercismExerciseTest >> testSolutionSources [
136136
sources := TestmanyTest exercise solutionSources.
137137

138138
classes := {Testmany. TestOtherClass}.
139-
classNames := classes collect: [ :c | c name, '.st' ].
139+
classNames := (classes collect: [ :c | c name, '.st' ]) copyWithFirst: 'TestResults.txt'.
140140

141141
self assertCollection: sources keys asSet equals: classNames asSet.
142142

143-
(sources at: classNames first) should includeSubstring: '#name : #', classes first name.
143+
(sources at: classNames first) should includeSubstring: 'Tested on:'.
144+
(sources at: classNames second) should includeSubstring: '#name : #', classes first name.
144145
(sources at: classNames last) should includeSubstring: '#name : #', classes last name.
145146
]
146147

‎dev/src/ExercismTools/ClyExercismFetchCommand.class.st

+5-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ ClyExercismFetchCommand >> execute [
7070

7171
submission ifNotNil: [
7272
UIManager default inform: 'Success, Happy Coding'.
73-
self browser selectClass: submission exercise testCase ]
73+
submission exercise
74+
ifNil: [
75+
ExDomainError signal: 'Missing exercise meta-data' ]
76+
ifNotNil: [ :exercise |
77+
self browser selectClass: exercise testCase ]]
7478
]
7579
on: ExDomainError do: [ :ex |
7680
self reportError: ex for: (submission ifNotNil: [ :s | s exerciseId ]) ]

‎dev/src/ExercismTools/ExercismExercise.class.st

+9-2
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,19 @@ ExercismExercise >> solutionId [
281281

282282
{ #category : #accessing }
283283
ExercismExercise >> solutionSources [
284-
| sources |
284+
"Answer a Dictionary of filename to source code mappings for the solution that will be saved on Exercism"
285+
286+
| sources testResult resultDictionary |
285287

286288
sources := ExTonelWriter new mappedSnapshot: self exercisePackageTag snapshot.
287289

290+
testResult := [ self testCase suite run] on: Error do: [ TestResult new ].
291+
resultDictionary := OrderedDictionary new
292+
at: 'TestResults.txt' put: testResult exercismSummary;
293+
yourself.
294+
288295
^ (self solutionClasses collect: [ :c | c name ])
289-
inject: Dictionary new
296+
inject: resultDictionary
290297
into: [ :result :c |
291298
result
292299
at: c , '.st' put: (sources at: c);

‎dev/src/ExercismTools/ExercismManager.class.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ExercismManager class >> isUserMode [
3838
"Answer true if exercism is loaded in a clean image with no dev tools"
3939

4040
^ ((IceRepository registry collect: [ :repo | repo name ])) asArray
41-
= #('iceberg' 'pharo' 'pharo-exercism')
41+
= #('iceberg' 'pharo' 'pharo-smalltalk')
4242
and: [ (RPackageOrganizer default
4343
packageNamed: 'ExercismDev'
4444
ifAbsent: [ nil ]) isNil ]

‎dev/src/ExercismTools/ExercismTest.class.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ExercismTest class >> createExerciseAfter: anotherTestCase [
1919
^ (ExercismExercise for: self)
2020
unlockedBy:
2121
((anotherTestCase notNil and: [ anotherTestCase isObsolete not ])
22-
ifTrue: [ anotherTestCase exercise ]
22+
ifTrue: [ [anotherTestCase exercise] on: SubclassResponsibility do: [ nil ] ]
2323
ifFalse: [ nil ]);
2424
yourself
2525
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Extension { #name : #TestResult }
2+
3+
{ #category : #'*ExercismTools' }
4+
TestResult >> exercismSummary [
5+
^String streamContents: [ :s | s
6+
nextPutAll: 'Tested on: ';
7+
nextPutAll: self timeStamp asLocalStringYMDHM;
8+
crlf;
9+
nextPutAll: self runCount printString;
10+
nextPutAll: ' run, ';
11+
nextPutAll: self expectedPassCount printString;
12+
nextPutAll: ' passes, ';
13+
nextPutAll: self skippedCount printString;
14+
nextPutAll: ' skipped, ';
15+
nextPutAll: self unexpectedFailureCount printString;
16+
nextPutAll: ' failures, ';
17+
nextPutAll: self unexpectedErrorCount printString;
18+
nextPutAll:' errors ' ]
19+
]

0 commit comments

Comments
 (0)
Please sign in to comment.