--- a/RegressionTests__CoverageInstrumentationTest.st Thu Nov 08 01:10:35 2012 +0100
+++ b/RegressionTests__CoverageInstrumentationTest.st Thu Nov 08 01:16:29 2012 +0100
@@ -12,6 +12,10 @@
!CoverageInstrumentationTest methodsFor:'testFunctions'!
+calledByF6
+ 'dummy'
+!
+
f1
^ 1234
!
@@ -42,6 +46,12 @@
1 to:loopCount do:[:i |
1 + 2 "should be executed 10 times, and coverage should see that"
].
+!
+
+f6:loopCount
+ 1 to:loopCount do:[:i |
+ self calledByF6
+ ].
! !
!CoverageInstrumentationTest methodsFor:'tests'!
@@ -193,10 +203,40 @@
"
self new test_05_instrumentation
"
+!
+
+test_06_instrumentation_methodInvokationCount
+ |m|
+
+ self class recompile:#f6: usingCompilerClass:InstrumentingCompiler.
+ self class recompile:#calledByF6 usingCompilerClass:InstrumentingCompiler.
+
+ m := (self class compiledMethodAt:#calledByF6).
+
+ self assert:(m hasBeenCalled not).
+ self assert:(m methodInvocationInfo hasBeenCalled not).
+ self assert:(m hasBeenCalled not).
+ self assert:(m methodInvocationInfo count == 0).
+
+ "/ execute
+ InstrumentationContext run:[
+ self f6:10.
+ ].
+
+ self assert:(m hasBeenCalled).
+ self assert:(m methodInvocationInfo count == 10).
+
+ "
+ self new test_06_instrumentation_methodInvokationCount
+ "
! !
!CoverageInstrumentationTest class methodsFor:'documentation'!
+version
+ ^ '$Header$'
+!
+
version_CVS
^ '$Header$'
! !