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

Side by Side Diff: test/debugger/debug/es6/debug-stepin-collections-foreach.js

Issue 2476303003: Revert of [debugger] Migrate more debugger tests to inspector (Closed)
Patch Set: 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
OLDNEW
(Empty)
1 // Copyright 2014 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
6 Debug = debug.Debug
7
8 var exception = null;
9
10 function listener(event, exec_state, event_data, data) {
11 try {
12 if (event == Debug.DebugEvent.Break) {
13 exec_state.prepareStep(Debug.StepAction.StepIn);
14 print(event_data.sourceLineText());
15 assertTrue(
16 event_data.sourceLineText().indexOf(`B${breaks++}`) > 0);
17 }
18 } catch (e) {
19 print(e);
20 quit();
21 exception = e;
22 }
23 }
24
25 function cb_set(num) {
26 print("element " + num); // B2 B5 B8
27 return true; // B3 B6 B9
28 } // B4 B7 B10
29
30 function cb_map(key, val) {
31 print("key " + key + ", value " + val); // B2 B5 B8
32 return true; // B3 B6 B9
33 } // B4 B7 B10
34
35 var s = new Set();
36 s.add(1);
37 s.add(2);
38 s.add(3);
39
40 var m = new Map();
41 m.set('foo', 1);
42 m.set('bar', 2);
43 m.set('baz', 3);
44
45 var breaks = 0;
46 Debug.setListener(listener);
47 debugger; // B0
48 s.forEach(cb_set); // B1
49 Debug.setListener(null); // B11
50 assertNull(exception);
51 assertEquals(12, breaks);
52
53 breaks = 0;
54 Debug.setListener(listener);
55 debugger; // B0
56 m.forEach(cb_map); // B1
57 Debug.setListener(null); // B11
58 assertNull(exception);
59 assertEquals(12, breaks);
60
61 // Test two levels of builtin callbacks:
62 // Array.forEach calls a callback function, which by itself uses
63 // Array.forEach with another callback function.
64
65 function cb_set_2(num) {
66 print("element " + num); // B3 B6 B9 B15 B18 B21 B27 B30 B33
67 return true; // B4 B7 B10 B16 B19 B22 B28 B31 B34
68 } // B5 B8 B11 B17 B20 B23 B29 B32 B35
69
70 function cb_map_2(k, v) {
71 print(`key ${k}, value ${v}`); // B3 B6 B9 B15 B18 B21 B27 B30 B33
72 return true; // B4 B7 B10 B16 B19 B22 B28 B31 B34
73 } // B5 B8 B11 B17 B20 B23 B29 B32 B35
74
75 function cb_set_foreach(num) {
76 s.forEach(cb_set_2); // B2 B14 B26
77 print("back."); // B12 B24 B36
78 } // B13 B25 B37
79
80 function cb_map_foreach(key, val) {
81 m.forEach(cb_map_2); // B2 B14 B26
82 print("back."); // B12 B24 B36
83 } // B13 B25 B37
84
85 breaks = 0;
86 Debug.setListener(listener);
87 debugger; // B0
88 s.forEach(cb_set_foreach); // B1
89 Debug.setListener(null); // B38
90 assertNull(exception);
91 assertEquals(39, breaks);
92
93 breaks = 0;
94 Debug.setListener(listener);
95 debugger; // B0
96 m.forEach(cb_map_foreach); // B1
97 Debug.setListener(null); // B38
98 assertNull(exception);
99 assertEquals(39, breaks);
OLDNEW
« no previous file with comments | « test/debugger/debug/es6/debug-step-into-regexp-subclass.js ('k') | test/debugger/debug/es6/debug-stepin-generators.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698