Le 05/02/2014 12:05, Usman Bhatti a écrit :
I see and I've been achieving it in another way.
aClass >> export
fileRef := UITheme builder
fileSave: 'Choose a file'
extensions: #('txt')
path: nil.
fileRef isNil ifFalse: [
self exportOn: fileRef writeStream
]
Instead of testing the method export, I test exportOn: with a stream as
a parameter.
What I am thinking is that, with this approach, we are not testing all
the execution paths in the method export. But then, with a Shim, we will
not be testing that path either.
No, it would be different with a Shim: you could test two times this
code, one with a nil answer, and another one with a fileReference answer.
You would do something like:
{nil. 'aPath'} do: [:d |
[ aShim setAsUITheme.
aShim preload: #fileSave:extension:path: withAnswer: d.
aClass export ]
ensure: [ aShim reset ]
]
And hop, your paths are covered.
Thierry
--
Thierry Goubier
CEA list
Laboratoire des Fondations des Systèmes Temps Réel Embarqués
91191 Gif sur Yvette Cedex
France
Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95