Well done, a real *masterpieche*! :-) Depreciated (marked as depreciated) classes could / should be moved either into a compatibility layer (sport) or, if only a few "apps" are using it, into the app itself, being slightly renamed for keeping up compatibility. This should work in a similar way by first identifying concerned apps, automatically moving - while renaming classes - into the app, exporting as new package. Does that make sense? How would u solve that? tnx in advance, Guido Stepken Am 21.02.2012 16:03 schrieb "Pavel Krivanek" <pavel.krivanek@gmail.com>:
Hi,
what about to intrroduce tests that will test coverage of tests? Some improved version of the code below. Are there some tool for Smalltalk showing uncovered lines of code? There are such tools in Java world :-) One little problem is that this code do not work on Linux because of a VM error that cause test failures on CI server too.
Cheers, Pavel
| class test trace classTrace result |
class := Time. test := TimeTest.
trace := Dictionary new.
thisContext runSimulated: [test suite run] contextAtEachStep: [ :current | | cls sel methods bytecodes | cls := current method methodClass. sel := current method selector. methods := trace at: cls ifAbsentPut: Dictionary new. bytecodes := methods at: sel ifAbsentPut: Set new. bytecodes add: current pc.]
trace .
result := String streamContents: [:s |
classTrace := trace at: class ifAbsent: nil. classTrace ifNil: [ s nextPutAll: 'Class ', class name, ' not called'; cr. ] ifNotNil: [ s nextPutAll: class name; cr. class selectorsDo: [:sel | | m usedBytecodes allBytecodes | m := class >> sel. usedBytecodes := (classTrace at: sel ifAbsent: Set new) size. allBytecodes := 0. m symbolicLinesDo: [:pc :lineForPC | allBytecodes := allBytecodes + 1 ].. s tab; nextPutAll: sel; nextPutAll: ' - '; nextPutAll: (usedBytecodes / allBytecodes * 100) asFloat asString; nextPutAll: '%'; cr. ]]. ]. result..