OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --expose-debug-as debug --harmony | 5 // Flags: --expose-debug-as debug --harmony |
6 | 6 |
7 Debug = debug.Debug; | 7 Debug = debug.Debug; |
8 var break_count = 0 | 8 var break_count = 0 |
9 var exception = null; | 9 var exception = null; |
10 var log = [] | 10 var log = [] |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 | 52 |
53 for (var i = 0; i < 3; i++) { // Break k | 53 for (var i = 0; i < 3; i++) { // Break k |
54 s += a[i]; // Break K | 54 s += a[i]; // Break K |
55 } | 55 } |
56 | 56 |
57 for (j = 0; j < 3; j++) { // Break l | 57 for (j = 0; j < 3; j++) { // Break l |
58 s += a[j]; // Break L | 58 s += a[j]; // Break L |
59 } | 59 } |
60 | 60 |
61 // TODO(yangguo): add test case for for-let. | 61 for (let i = 0; i < 3; i++) { // Break m |
| 62 s += a[i]; // Break M |
| 63 } |
62 } // Break y | 64 } // Break y |
63 | 65 |
64 function listener(event, exec_state, event_data, data) { | 66 function listener(event, exec_state, event_data, data) { |
65 if (event != Debug.DebugEvent.Break) return; | 67 if (event != Debug.DebugEvent.Break) return; |
66 try { | 68 try { |
67 var line = exec_state.frame(0).sourceLineText(); | 69 var line = exec_state.frame(0).sourceLineText(); |
68 var col = exec_state.frame(0).sourceColumn(); | 70 var col = exec_state.frame(0).sourceColumn(); |
69 print(line); | 71 print(line); |
70 var match = line.match(/\/\/ Break (\w)$/); | 72 var match = line.match(/\/\/ Break (\w)$/); |
71 assertEquals(2, match.length); | 73 assertEquals(2, match.length); |
(...skipping 28 matching lines...) Expand all Loading... |
100 // For-of-var: next(), body, next(), body, ... | 102 // For-of-var: next(), body, next(), body, ... |
101 "h16","H4","h16","H4","h16","H4","h16", | 103 "h16","H4","h16","H4","h16","H4","h16", |
102 // For-of: next(), body, next(), body, ... | 104 // For-of: next(), body, next(), body, ... |
103 "i12","I4","i12","I4","i12","I4","i12", | 105 "i12","I4","i12","I4","i12","I4","i12", |
104 // For-of-let: next(), body, next(), ... | 106 // For-of-let: next(), body, next(), ... |
105 "j16","J4","j16","J4","j16","J4","j16", | 107 "j16","J4","j16","J4","j16","J4","j16", |
106 // For-var: var decl, condition, body, next, condition, body, ... | 108 // For-var: var decl, condition, body, next, condition, body, ... |
107 "k7","k20","K4","k23","k20","K4","k23","k20","K4","k23","k20", | 109 "k7","k20","K4","k23","k20","K4","k23","k20","K4","k23","k20", |
108 // For: init, condition, body, next, condition, body, ... | 110 // For: init, condition, body, next, condition, body, ... |
109 "l7","l16","L4","l19","l16","L4","l19","l16","L4","l19","l16", | 111 "l7","l16","L4","l19","l16","L4","l19","l16","L4","l19","l16", |
| 112 // For-let: init, condition, body, next, condition, body, ... |
| 113 "m7","m20","M4","m23","m20","M4","m23","m20","M4","m23","m20", |
110 // Exit. | 114 // Exit. |
111 "y0","z0", | 115 "y0","z0", |
112 ] | 116 ] |
113 print("expected:\n"+ JSON.stringify(expected)); | 117 print("expected:\n"+ JSON.stringify(expected)); |
114 | 118 |
115 assertArrayEquals(expected, log); | 119 assertArrayEquals(expected, log); |
116 assertEquals(48, s); | 120 assertEquals(54, s); |
117 assertNull(exception); | 121 assertNull(exception); |
OLD | NEW |