# HG changeset patch # User Claus Gittinger # Date 1504098964 -7200 # Node ID d8d6e704ac8f3c1b40d6ac19bc609e01a31bdeb2 # Parent e2428b24d753a0fb8062b4b995c0bb8524bc5a09 #DOCUMENTATION by cg class: TestCase class comment/format in: #coveredClasses category of: #coveredClasses diff -r e2428b24d753 -r d8d6e704ac8f TestCase.st --- a/TestCase.st Wed Jul 26 12:46:18 2017 +0200 +++ b/TestCase.st Wed Aug 30 15:16:04 2017 +0200 @@ -1,5 +1,3 @@ -"{ Encoding: utf8 }" - "{ Package: 'stx:goodies/sunit' }" "{ NameSpace: Smalltalk }" @@ -354,6 +352,33 @@ "Modified: / 21-04-2010 / 23:19:14 / Jan Vrany " ! +coveredClasses + "return a collection of classes which are tested by this suite/case. + Do not redefine this; redefine either coveredClassNames or + coveredPackageNames + (these return names, to avoid creating + a package dependecy due to the class references) + + These classes can be instrumented for coverage analysis, + before running the suite to provide coverage analysis/report" + + |names| + + (names := self coveredPackageNames) notEmptyOrNil ifTrue:[ + ^ names + collectAll:[:eachPackageOrPattern | + eachPackageOrPattern includesMatchCharacters ifTrue:[ + Smalltalk allClassesForWhich:[:cls | (cls package ?'') matches:eachPackageOrPattern]. + ] ifFalse:[ + Smalltalk allClassesInPackage:eachPackageOrPattern + ] + ]. + ]. + ^ self coveredClassNames collect:[:each | Smalltalk classNamed:each] + + "Modified (comment): / 30-08-2017 / 11:09:22 / cg" +! + lastTestRunResultChanged: selector Smalltalk changed:#lastTestRunResult with:(Array with:self with:selector). @@ -389,31 +414,6 @@ "Created: / 06-07-2011 / 21:27:03 / cg" ! -coveredClasses - "return a collection of classes which are tested by this suite/case. - Do not redefine this; redefine either coveredClassNames or - coveredPackageNames - (these return names, to avoid creating - a package dependecy due to the class references) - - These classes can be instrumented for coverage analysis, - before running the suite to provide coverage analysis/report" - - |names| - - (names := self coveredPackageNames) notEmptyOrNil ifTrue:[ - ^ names - collectAll:[:eachPackageOrPattern | - eachPackageOrPattern includesMatchCharacters ifTrue:[ - Smalltalk allClassesForWhich:[:cls | (cls package ?'') matches:eachPackageOrPattern]. - ] ifFalse:[ - Smalltalk allClassesInPackage:eachPackageOrPattern - ] - ]. - ]. - ^ self coveredClassNames collect:[:each | Smalltalk classNamed:each] -! - coveredPackageNames "redefine this in a concrete testCase class to return non-nil, to return a collection of packages which are tested by this suite/case.