RegressionTests__DebuggerTest.st
branchjv
changeset 1500 d406a10b2965
parent 1499 26a16a04219b
parent 1447 2351db93aa5b
equal deleted inserted replaced
1499:26a16a04219b 1500:d406a10b2965
    14 documentation
    14 documentation
    15 "
    15 "
    16      documentation to be added.
    16      documentation to be added.
    17 
    17 
    18     [author:]
    18     [author:]
    19         Claus Gittinger (cg@alan)
    19 	Claus Gittinger (cg@alan)
    20 
    20 
    21     [instance variables:]
    21     [instance variables:]
    22 
    22 
    23     [class variables:]
    23     [class variables:]
    24 
    24 
    45     contextInspectorOK := true.
    45     contextInspectorOK := true.
    46 
    46 
    47     a := #( 1 2 3 4 ).
    47     a := #( 1 2 3 4 ).
    48     b := #( 9 8 7 6 ).
    48     b := #( 9 8 7 6 ).
    49     a do:[:eachA |
    49     a do:[:eachA |
    50         b do:[:eachB |
    50 	b do:[:eachB |
    51             " you should see both eachA and eachB in the debugger "
    51 	    " you should see both eachA and eachB in the debugger "
    52             " eachA must be 1
    52 	    " eachA must be 1
    53               eachB must be 9
    53 	      eachB must be 9
    54             "
    54 	    "
    55 
    55 
    56             "/ cg: wait for the debugger to come up,
    56 	    "/ cg: wait for the debugger to come up,
    57             "/ take a look at its local-variables inspector...
    57 	    "/ take a look at its local-variables inspector...
    58 
    58 
    59             me := Processor activeProcess.
    59 	    me := Processor activeProcess.
    60 
    60 
    61             [
    61 	    [
    62                 |debuggers theDebugger fieldList idx|
    62 		|debuggers theDebugger fieldList idx|
    63 
    63 
    64                 Delay waitForSeconds:0.5.
    64 		Delay waitForSeconds:0.5.
    65 
    65 
    66                 debuggers := DebugView allInstances select:[:dbg | dbg inspectedProcess == me].
    66 		debuggers := DebugView allInstances select:[:dbg | dbg inspectedProcess == me].
    67                 self assert:(debuggers size == 1).
    67 		self assert:(debuggers size == 1).
    68                 theDebugger := debuggers first.
    68 		theDebugger := debuggers first.
    69                 fieldList := theDebugger contextInspector fieldList.
    69 		fieldList := theDebugger contextInspector fieldList.
    70                 idx := fieldList findFirst:[:e | e string startsWith:'eachB '].
    70 		idx := fieldList findFirst:[:e | e string startsWith:'eachB '].
    71                 idx == 0 ifTrue:[
    71 		idx == 0 ifTrue:[
    72                     contextInspectorOK := false
    72 		    contextInspectorOK := false
    73                 ] ifFalse:[
    73 		] ifFalse:[
    74                     (theDebugger contextInspector valueAtLine:idx) == eachB ifFalse:[
    74 		    (theDebugger contextInspector valueAtLine:idx) == eachB ifFalse:[
    75                         contextInspectorOK := false
    75 			contextInspectorOK := false
    76                     ].
    76 		    ].
    77                 ].
    77 		].
    78                 idx := fieldList findFirst:[:e | e string startsWith:'eachA '].
    78 		idx := fieldList findFirst:[:e | e string startsWith:'eachA '].
    79                 idx == 0 ifTrue:[
    79 		idx == 0 ifTrue:[
    80                     contextInspectorOK := false
    80 		    contextInspectorOK := false
    81                 ] ifFalse:[
    81 		] ifFalse:[
    82                     (theDebugger contextInspector valueAtLine:idx) == eachA ifFalse:[
    82 		    (theDebugger contextInspector valueAtLine:idx) == eachA ifFalse:[
    83                         contextInspectorOK := false
    83 			contextInspectorOK := false
    84                     ].
    84 		    ].
    85                 ].
    85 		].
    86                 me interruptWith:[theDebugger doAbort "AbortOperationRequest raise"].
    86 		me interruptWith:[theDebugger doAbort "AbortOperationRequest raise"].
    87             ] fork.
    87 	    ] fork.
    88 
    88 
    89             AbortOperationRequest handle:[:ex |
    89 	    AbortOperationRequest handle:[:ex |
    90             ] do:[
    90 	    ] do:[
    91                 self halt:'checking variables in the debugger...'.
    91 		self halt:'checking variables in the debugger...'.
    92             ].
    92 	    ].
    93             self assert:contextInspectorOK.
    93 	    self assert:contextInspectorOK.
    94         ]
    94 	]
    95     ]
    95     ]
    96 
    96 
    97     "
    97     "
    98      self run:#testBlockVars_01
    98      self run:#testBlockVars_01
    99      self new testBlockVars_01
    99      self new testBlockVars_01
   106     contextInspectorOK := true.
   106     contextInspectorOK := true.
   107 
   107 
   108     a := #( 1 2 3 4 ).
   108     a := #( 1 2 3 4 ).
   109     b := #( 9 8 7 6 ).
   109     b := #( 9 8 7 6 ).
   110     a do:[:eachA |
   110     a do:[:eachA |
   111         |outer|
   111 	|outer|
   112 
   112 
   113         outer := eachA + 1.
   113 	outer := eachA + 1.
   114         b do:[:eachB |
   114 	b do:[:eachB |
   115             |inner|
   115 	    |inner|
   116 
   116 
   117             inner := eachB + 1.
   117 	    inner := eachB + 1.
   118 
   118 
   119             " you should see both eachA and eachB and outer and inner in the debugger "
   119 	    " you should see both eachA and eachB and outer and inner in the debugger "
   120             " eachA must be 1 ; outer must be 2
   120 	    " eachA must be 1 ; outer must be 2
   121               eachB must be 9 ; inner must be 10.
   121 	      eachB must be 9 ; inner must be 10.
   122             "
   122 	    "
   123             "/ cg: wait for the debugger to come up,
   123 	    "/ cg: wait for the debugger to come up,
   124             "/ take a look at its local-variables inspector...
   124 	    "/ take a look at its local-variables inspector...
   125 
   125 
   126             me := Processor activeProcess.
   126 	    me := Processor activeProcess.
   127 
   127 
   128             [
   128 	    [
   129                 |debuggers theDebugger fieldList idx|
   129 		|debuggers theDebugger fieldList idx|
   130 
   130 
   131                 Delay waitForSeconds:0.5.
   131 		Delay waitForSeconds:0.5.
   132 
   132 
   133                 debuggers := DebugView allInstances select:[:dbg | dbg inspectedProcess == me].
   133 		debuggers := DebugView allInstances select:[:dbg | dbg inspectedProcess == me].
   134                 self assert:(debuggers size == 1).
   134 		self assert:(debuggers size == 1).
   135                 theDebugger := debuggers first.
   135 		theDebugger := debuggers first.
   136                 fieldList := theDebugger contextInspector fieldList.
   136 		fieldList := theDebugger contextInspector fieldList.
   137                 idx := fieldList findFirst:[:e | e string startsWith:'eachB '].
   137 		idx := fieldList findFirst:[:e | e string startsWith:'eachB '].
   138                 idx == 0 ifTrue:[
   138 		idx == 0 ifTrue:[
   139                     contextInspectorOK := false
   139 		    contextInspectorOK := false
   140                 ] ifFalse:[
   140 		] ifFalse:[
   141                     (theDebugger contextInspector valueAtLine:idx) == eachB ifFalse:[
   141 		    (theDebugger contextInspector valueAtLine:idx) == eachB ifFalse:[
   142                         contextInspectorOK := false
   142 			contextInspectorOK := false
   143                     ].
   143 		    ].
   144                 ].
   144 		].
   145                 idx := fieldList findFirst:[:e | e string startsWith:'eachA '].
   145 		idx := fieldList findFirst:[:e | e string startsWith:'eachA '].
   146                 idx == 0 ifTrue:[
   146 		idx == 0 ifTrue:[
   147                     contextInspectorOK := false
   147 		    contextInspectorOK := false
   148                 ] ifFalse:[
   148 		] ifFalse:[
   149                     (theDebugger contextInspector valueAtLine:idx) == eachA ifFalse:[
   149 		    (theDebugger contextInspector valueAtLine:idx) == eachA ifFalse:[
   150                         contextInspectorOK := false
   150 			contextInspectorOK := false
   151                     ].
   151 		    ].
   152                 ].
   152 		].
   153                 me interruptWith:[theDebugger doAbort "AbortOperationRequest raise"].
   153 		me interruptWith:[theDebugger doAbort "AbortOperationRequest raise"].
   154             ] fork.
   154 	    ] fork.
   155 
   155 
   156             AbortOperationRequest handle:[:ex |
   156 	    AbortOperationRequest handle:[:ex |
   157             ] do:[
   157 	    ] do:[
   158                 self halt:'checking variables in the debugger...'.
   158 		self halt:'checking variables in the debugger...'.
   159             ].
   159 	    ].
   160             self assert:contextInspectorOK.
   160 	    self assert:contextInspectorOK.
   161         ]
   161 	]
   162     ]
   162     ]
   163 
   163 
   164     "
   164     "
   165      self run:#testBlockVars_02
   165      self run:#testBlockVars_02
   166      self new testBlockVars_02
   166      self new testBlockVars_02
   167     "
   167     "
   168 !
   168 !
   169 
   169 
   170 testSteppingInEnsureBlock_01
   170 testSteppingInEnsureBlock_01
   171     self halt:'proceed stepping with "next"-Button'.
   171     self halt:'proceed stepping with "next"-Button'.
   172     " 
   172     "
   173      you should be able to single-step through all step-sends...
   173      you should be able to single-step through all step-sends...
   174     "
   174     "
   175     self step:1.
   175     self step:1.
   176     [
   176     [
   177         self step:2.
   177 	self step:2.
   178         self step:3.
   178 	self step:3.
   179     ] ensure:[
   179     ] ensure:[
   180         self step:4
   180 	self step:4
   181     ].
   181     ].
   182     self step:5
   182     self step:5
   183 
   183 
   184     "
   184     "
   185      self run:#testSteppingInEnsureBlock_01
   185      self run:#testSteppingInEnsureBlock_01