Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: test/mjsunit/debug-negative-break-points.js

Issue 2512963002: [debug-wrapper] Migrate more tests (Closed)
Patch Set: Rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/debug-multiple-breakpoints.js ('k') | test/mjsunit/debug-receiver.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --expose-debug-as debug
6
7 var Debug = debug.Debug;
8 var break_count = 0;
9 var exception_count = 0;
10
11 function assertCount(expected_breaks, expected_exceptions) {
12 assertEquals(expected_breaks, break_count);
13 assertEquals(expected_exceptions, exception_count);
14 }
15
16 function listener(event, exec_state, event_data, data) {
17 if (event == Debug.DebugEvent.Break) {
18 break_count++;
19 } else if (event == Debug.DebugEvent.Exception) {
20 exception_count++;
21 }
22 }
23
24 function f(x) {
25 debugger;
26 return x + 1;
27 }
28
29 function g(x) {
30 try {
31 throw x;
32 } catch (e) {
33 }
34 }
35
36 function h(x) {
37 var a = undefined;
38 try {
39 var x = a();
40 } catch (e) {
41 }
42 }
43
44 Debug.setListener(listener);
45
46 assertCount(0, 0);
47 f(0);
48 assertCount(1, 0);
49 g(0);
50 assertCount(1, 0);
51
52 Debug.setBreakOnException();
53 f(0);
54 assertCount(2, 0);
55 g(0);
56 assertCount(2, 1);
57
58 Debug.setBreakPoint(f, 1, 0, "x == 1");
59 f(1);
60 assertCount(3, 1);
61 f(2);
62 assertCount(3, 1);
63 f(1);
64 assertCount(4, 1);
65
66 Debug.setBreakPoint(f, 1, 0, "x > 0");
67 f(1);
68 assertCount(5, 1);
69 f(0);
70 assertCount(5, 1);
71
72 Debug.setBreakPoint(g, 2, 0, "1 == 2");
73 g(1);
74 assertCount(5, 1);
75
76 Debug.setBreakPoint(g, 2, 0, "x == 1");
77 g(1);
78 assertCount(6, 2);
79 g(2);
80 assertCount(6, 2);
81 g(1);
82 assertCount(7, 3);
83
84 Debug.setBreakPoint(g, 2, 0, "x > 0");
85 g(1);
86 assertCount(8, 4);
87 g(0);
88 assertCount(8, 4);
89
90 h(0);
91 assertCount(8, 5);
92 Debug.setBreakPoint(h, 3, 0, "x > 0");
93 h(1);
94 assertCount(9, 6);
95 h(0);
96 assertCount(9, 6);
97
98 Debug.clearBreakOnException();
99 Debug.setListener(null);
OLDNEW
« no previous file with comments | « test/mjsunit/debug-multiple-breakpoints.js ('k') | test/mjsunit/debug-receiver.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698