OLD | NEW |
---|---|
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 // b=2; | 111 // b=2; |
112 // }[B0] | 112 // }[B0] |
113 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]}") > 0); | 113 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]}") > 0); |
114 assertTrue(Debug.showBreakPoints(g).indexOf("[B1]") < 0); | 114 assertTrue(Debug.showBreakPoints(g).indexOf("[B1]") < 0); |
115 Debug.clearBreakPoint(bp3); | 115 Debug.clearBreakPoint(bp3); |
116 // function g() { | 116 // function g() { |
117 // a=1; | 117 // a=1; |
118 // b=2; | 118 // b=2; |
119 // } | 119 // } |
120 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]") < 0); | 120 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]") < 0); |
121 | |
122 | |
123 // Tests for setting break points by script id and position. | |
124 function setBreakpointByPosition(f, position) | |
125 { | |
126 var break_point = Debug.setBreakPointByScriptIdAndPosition( | |
Søren Thygesen Gjesse
2011/01/14 11:20:06
Only 2 char indent.
| |
127 Debug.findScript(f).id, | |
128 position + Debug.sourcePosition(f), | |
129 "", | |
130 true); | |
131 return break_point.number(); | |
132 } | |
133 | |
134 bp = setBreakpointByPosition(f, 0); | |
135 assertEquals("() {[B0]a=1;b=2}", Debug.showBreakPoints(f)); | |
136 Debug.clearBreakPoint(bp); | |
137 assertEquals("() {a=1;b=2}", Debug.showBreakPoints(f)); | |
138 bp1 = setBreakpointByPosition(f, 8); | |
139 assertEquals("() {a=1;[B0]b=2}", Debug.showBreakPoints(f)); | |
140 bp2 = setBreakpointByPosition(f, 4); | |
141 assertEquals("() {[B0]a=1;[B1]b=2}", Debug.showBreakPoints(f)); | |
142 bp3 = setBreakpointByPosition(f, 11); | |
143 assertEquals("() {[B0]a=1;[B1]b=2[B2]}", Debug.showBreakPoints(f)); | |
144 Debug.clearBreakPoint(bp1); | |
145 assertEquals("() {[B0]a=1;b=2[B1]}", Debug.showBreakPoints(f)); | |
146 Debug.clearBreakPoint(bp2); | |
147 assertEquals("() {a=1;b=2[B0]}", Debug.showBreakPoints(f)); | |
148 Debug.clearBreakPoint(bp3); | |
149 assertEquals("() {a=1;b=2}", Debug.showBreakPoints(f)); | |
150 | |
151 bp = setBreakpointByPosition(g, 0); | |
152 //function g() { | |
153 //[B0]a=1; | |
154 //b=2; | |
155 //} | |
156 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]a=1;") > 0); | |
157 Debug.clearBreakPoint(bp); | |
158 //function g() { | |
159 //a=1; | |
160 //b=2; | |
161 //} | |
162 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]") < 0); | |
163 | |
164 //Second test set and clear breakpoints on lines 1, 2 and 3 (column = 0). | |
165 bp1 = setBreakpointByPosition(g, 12); | |
166 //function g() { | |
167 //a=1; | |
168 //[B0]b=2; | |
169 //} | |
170 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]b=2;") > 0); | |
171 bp2 = setBreakpointByPosition(g, 5); | |
172 //function g() { | |
173 //[B0]a=1; | |
174 //[B1]b=2; | |
175 //} | |
176 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]a=1;") > 0); | |
177 assertTrue(Debug.showBreakPoints(g).indexOf("[B1]b=2;") > 0); | |
178 bp3 = setBreakpointByPosition(g, 19); | |
179 //function g() { | |
180 //[B0]a=1; | |
181 //[B1]b=2; | |
182 //}[B2] | |
183 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]a=1;") > 0); | |
184 assertTrue(Debug.showBreakPoints(g).indexOf("[B1]b=2;") > 0); | |
185 assertTrue(Debug.showBreakPoints(g).indexOf("[B2]}") > 0); | |
186 Debug.clearBreakPoint(bp1); | |
187 //function g() { | |
188 //[B0]a=1; | |
189 //b=2; | |
190 //}[B1] | |
191 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]a=1;") > 0); | |
192 assertTrue(Debug.showBreakPoints(g).indexOf("[B1]}") > 0); | |
193 assertTrue(Debug.showBreakPoints(g).indexOf("[B2]") < 0); | |
194 Debug.clearBreakPoint(bp2); | |
195 //function g() { | |
196 //a=1; | |
197 //b=2; | |
198 //}[B0] | |
199 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]}") > 0); | |
200 assertTrue(Debug.showBreakPoints(g).indexOf("[B1]") < 0); | |
201 Debug.clearBreakPoint(bp3); | |
202 //function g() { | |
203 //a=1; | |
204 //b=2; | |
205 //} | |
206 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]") < 0); | |
OLD | NEW |