BookTestGeneratorTest and ScreenshotTransformerTest should not break the first they are run.
BookTestGeneratorTest >> testMethodCreationFailingCodeBlock ScreenshotTransformerTest >> testTransformerCreatesFile
Are apparently failing the first time they are executed
Put an halt before running them the first time!
I skipped testTransformerCreatesFile
un and strange
When I execute the tests of booktester they pass and generate code like that in a class
test6
self assert: (('1' + 2)>>>14) isPaired
And from time to time the exact same tests generates
"protocol: #'as yet unclassified'"
test6
self assert: Error signal description: 'A code block failed'.
"ProcessAlreadyTerminating was raised with: "
"by the codeblock: ('1' + 2)>>>14”
When I look at the process browser…. there is our friend calypso atomic update.
compileMethod: aResult
| isCorrect |
[ (self class environment
at: aResult fragmentedText first first trimBoth asSymbol)
compileSilently:
aResult fragmentedText second
,
'
' , aResult fragmentedText third
classified: 'book tester'.
isCorrect := true ]
on: Exception
do: [ :ex |
aResult explanation: ex asString.
isCorrect := false ].
^ isCorrect
Seem correct
Now may be the problem is around here
createTestMethodFrom: aCodeblock
"The test method is compiled using the following template, either it raises no exception:
test(cbIndex)
self assert: (ourAssociation) isPaired
or it raises one:
test(cbIndex)
self assert: false description: [ theCodeBlock test raised the exception: (theException) ]"
[ (self class environment at: fileName asSymbol)
compile:
'test' , cbIndex asString
,
'
self assert: (' , aCodeblock textForExample withSeparatorsCompacted
, ') isPaired'
classified: 'Compiled ok tests' ]
on: Exception
do: [ :e |
et si tu mettais un halt ici? Ce serait intéressant de voir la stack/processus qui fait ceci
(self class environment at: fileName asSymbol)
compile:
(String
streamContents: [ :s |
s << 'test' << cbIndex asString.
s
cr;
cr;
tab.
s
<< 'self assert: Error signal description: ''A code block failed''. '.
s
cr;
tab.
s << '"' << e class name << ' was raised with: '
<< (e messageText copyWithout: $") << '"'.
s
cr;
tab.
s << '"' << 'by the codeblock: '
<< (aCodeblock textForExample withSeparatorsCompacted copyWithout: $")
<< '"' ])
classified: 'Broken book tests’ ]