RegressionTests__BreakpointTests.st
changeset 901 6d1135b74284
child 913 ea6dc6b55822
equal deleted inserted replaced
900:7acbd0cce153 901:6d1135b74284
       
     1 "{ Package: 'exept:regression' }"
       
     2 
       
     3 "{ NameSpace: RegressionTests }"
       
     4 
       
     5 TestCase subclass:#BreakpointTests
       
     6 	instanceVariableNames:''
       
     7 	classVariableNames:''
       
     8 	poolDictionaries:''
       
     9 	category:'tests-Regression'
       
    10 !
       
    11 
       
    12 !BreakpointTests class methodsFor:'documentation'!
       
    13 
       
    14 documentation
       
    15 "
       
    16     Testcase to test VM breakpoint support (aka Jan's new breakpoints).
       
    17     If the VM is not compiled with new breakpoint support, this tests should
       
    18     be skipped.
       
    19 
       
    20     [author:]
       
    21         Jan Vrany <jan.vrany@fit.cvut.cz>
       
    22 
       
    23     [instance variables:]
       
    24 
       
    25     [class variables:]
       
    26 
       
    27     [see also:]
       
    28 
       
    29 "
       
    30 ! !
       
    31 
       
    32 !BreakpointTests methodsFor:'accessing'!
       
    33 
       
    34 shouldSkip
       
    35     "Returns true, if this testcase should be skipped when a testsuite is run.
       
    36      This inly a hint, a test runner is not obliged to respect return value.
       
    37 
       
    38      Currently, the only user is stx/goodies/builder/reports"
       
    39 
       
    40     ^ConfigurableFeatures includesFeature: #VMBreakpointSupport
       
    41 
       
    42     "Created: / 09-04-2013 / 11:53:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    43 ! !
       
    44 
       
    45 !BreakpointTests methodsFor:'mock methods'!
       
    46 
       
    47 m00
       
    48     self zork.
       
    49     self zork.
       
    50 
       
    51     "Created: / 09-04-2013 / 12:01:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    52 !
       
    53 
       
    54 m01: a1
       
    55     self zork.
       
    56     self zork.
       
    57 
       
    58     "Created: / 09-04-2013 / 12:01:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    59 !
       
    60 
       
    61 m02: a1 _: a2
       
    62     self zork.
       
    63     self zork.
       
    64 
       
    65     "Created: / 09-04-2013 / 12:01:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    66 !
       
    67 
       
    68 m03: a1 _: a2 _: a3
       
    69     self zork.
       
    70     self zork.
       
    71 
       
    72     "Created: / 09-04-2013 / 12:01:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    73 !
       
    74 
       
    75 m04: a1 _: a2 _: a3 _: a4
       
    76     self zork.
       
    77     self zork.
       
    78 
       
    79     "Created: / 09-04-2013 / 12:01:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    80 !
       
    81 
       
    82 m05: a1 _: a2 _: a3 _: a4 _: a5
       
    83     self zork.
       
    84     self zork.
       
    85 
       
    86     "Created: / 09-04-2013 / 12:02:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    87 !
       
    88 
       
    89 m06: a1 _: a2 _: a3 _: a4 _: a5 _: a6
       
    90     self zork.
       
    91     self zork.
       
    92 
       
    93     "Created: / 09-04-2013 / 12:02:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    94 !
       
    95 
       
    96 m07: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7
       
    97     self zork.
       
    98     self zork.
       
    99 
       
   100     "Created: / 09-04-2013 / 12:02:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   101 !
       
   102 
       
   103 m08: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8
       
   104     self zork.
       
   105     self zork.
       
   106 
       
   107     "Created: / 09-04-2013 / 12:02:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   108 !
       
   109 
       
   110 m09: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9
       
   111     self zork.
       
   112     self zork.
       
   113 
       
   114     "Created: / 09-04-2013 / 12:02:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   115 !
       
   116 
       
   117 m10: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10
       
   118     self zork.
       
   119     self zork.
       
   120 
       
   121     "Created: / 09-04-2013 / 12:03:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   122 !
       
   123 
       
   124 m11: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11
       
   125     self zork.
       
   126     self zork.
       
   127 
       
   128     "Created: / 09-04-2013 / 12:03:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   129 !
       
   130 
       
   131 m12: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12
       
   132     self zork.
       
   133     self zork.
       
   134 
       
   135     "Created: / 09-04-2013 / 12:03:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   136 !
       
   137 
       
   138 m13: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12 _: a13
       
   139     self zork.
       
   140     self zork.
       
   141 
       
   142     "Created: / 09-04-2013 / 12:03:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   143 !
       
   144 
       
   145 m14: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12 _: a13 _: a14
       
   146     self zork.
       
   147     self zork.
       
   148 
       
   149     "Created: / 09-04-2013 / 12:03:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   150 !
       
   151 
       
   152 m15: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12 _: a13 _: a14 _: a15
       
   153     self zork.
       
   154     self zork.
       
   155 
       
   156     "Created: / 09-04-2013 / 12:03:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   157 !
       
   158 
       
   159 mWithTwoSendsOnLine
       
   160     self zork. self zork.
       
   161     self zork.
       
   162 
       
   163     "Created: / 15-04-2013 / 15:08:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   164 !
       
   165 
       
   166 mWithTwoSendsOnLineInCascade
       
   167     self zork; zork.
       
   168     self zork.
       
   169 
       
   170     "Created: / 15-04-2013 / 15:12:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   171 !
       
   172 
       
   173 zork
       
   174 
       
   175     "Created: / 09-04-2013 / 12:00:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   176 ! !
       
   177 
       
   178 !BreakpointTests methodsFor:'running'!
       
   179 
       
   180 tearDown
       
   181     | sels |
       
   182 
       
   183     sels :=  self class testSelectors.
       
   184     self class methodDictionary keysAndValuesDo:[:sel :m|
       
   185         (sels includes: sel) ifFalse:[
       
   186             m breakpointTable: nil.
       
   187         ]
       
   188     ]
       
   189 
       
   190     "Created: / 09-04-2013 / 12:27:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   191 ! !
       
   192 
       
   193 !BreakpointTests methodsFor:'tests'!
       
   194 
       
   195 helper_01: selector
       
   196     | a m nhits |
       
   197 
       
   198     m := self class >> selector.                                  
       
   199     MessageTracer breakMethod: m atLine: 2.
       
   200     a := Array new: m numArgs.
       
   201 
       
   202     nhits := 0.
       
   203     [       
       
   204             self perform: selector withArguments: a
       
   205     ] on: BreakPointInterrupt do:[:ex|
       
   206             Transcript nextPutLine: 'Breakpointed in ' , selector.
       
   207             nhits := nhits + 1.
       
   208             MessageTracer breakMethod: m atLine: 3.          
       
   209             ex proceed.
       
   210     ].
       
   211 
       
   212     self assert: nhits == 2.
       
   213 
       
   214     "Created: / 10-04-2013 / 10:50:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   215     "Modified: / 16-04-2013 / 00:55:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   216 !
       
   217 
       
   218 test_01
       
   219 
       
   220     self helper_01: #m00.
       
   221     self helper_01: #m01:.
       
   222     self helper_01: #m02:_:.
       
   223     self helper_01: #m03:_:_:.
       
   224     self helper_01: #m04:_:_:_:.
       
   225     self helper_01: #m05:_:_:_:_:.
       
   226     self helper_01: #m06:_:_:_:_:_:.
       
   227     self helper_01: #m07:_:_:_:_:_:_:.
       
   228     self helper_01: #m08:_:_:_:_:_:_:_:.
       
   229     self helper_01: #m09:_:_:_:_:_:_:_:_:.
       
   230     self helper_01: #m10:_:_:_:_:_:_:_:_:_:.
       
   231     self helper_01: #m11:_:_:_:_:_:_:_:_:_:_:.
       
   232     self helper_01: #m12:_:_:_:_:_:_:_:_:_:_:_:.
       
   233     self helper_01: #m13:_:_:_:_:_:_:_:_:_:_:_:_:.
       
   234     self helper_01: #m14:_:_:_:_:_:_:_:_:_:_:_:_:_:.
       
   235     self helper_01: #m15:_:_:_:_:_:_:_:_:_:_:_:_:_:_:.
       
   236 
       
   237     "Created: / 09-04-2013 / 12:12:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   238     "Modified: / 10-04-2013 / 10:50:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   239 !
       
   240 
       
   241 test_01b
       
   242     | m s |
       
   243 
       
   244     m := self class >> #m00.
       
   245     s := #STC_m00.
       
   246 
       
   247     ChangeSet withoutUpdatingChangesDo:[
       
   248         ParserFlags withSTCCompilation:#always do:[
       
   249             self class compile: 'STC_', m source classified: 'mock methods - *dynamic*'
       
   250         ].
       
   251     ].
       
   252     [
       
   253         self helper_01: s.
       
   254     ] ensure:[
       
   255         self class removeSelector: s.
       
   256     ]
       
   257 
       
   258     "Created: / 15-04-2013 / 14:57:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   259 !
       
   260 
       
   261 test_02a
       
   262     "
       
   263     Tests two breakpoints on the same line.    
       
   264     "
       
   265     self helper_01: #mWithTwoSendsOnLine
       
   266 
       
   267     "Created: / 15-04-2013 / 15:12:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   268 !
       
   269 
       
   270 test_02b
       
   271     "
       
   272     Tests two breakpoints on the same line using cascade/
       
   273     "
       
   274     self helper_01: #mWithTwoSendsOnLineInCascade
       
   275 
       
   276     "Created: / 15-04-2013 / 15:13:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   277 ! !
       
   278 
       
   279 !BreakpointTests class methodsFor:'documentation'!
       
   280 
       
   281 version
       
   282     ^ '$Header$'
       
   283 !
       
   284 
       
   285 version_CVS
       
   286     ^ '$Header$'
       
   287 ! !
       
   288