OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 | 5 // Flags: --expose-debug-as debug |
6 | 6 |
7 Debug = debug.Debug | 7 Debug = debug.Debug |
8 | 8 |
9 function BestEditor() { | 9 function BestEditor() { |
10 var best_editor = "Emacs"; | 10 return 'Emacs'; |
11 return best_editor; | |
12 } | 11 } |
13 | 12 |
14 var exception = null; | 13 var exception = null; |
15 var results = []; | 14 var results = []; |
16 var log = [] | 15 var log = [] |
17 | 16 |
18 function listener(event, exec_state, event_data, data) { | 17 function listener(event, exec_state, event_data, data) { |
19 if (event != Debug.DebugEvent.Break) return; | 18 if (event != Debug.DebugEvent.Break) return; |
20 try { | 19 try { |
21 var source_line = event_data.sourceLineText(); | 20 var source_line = event_data.sourceLineText(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 results.push(BestEditor()); | 54 results.push(BestEditor()); |
56 results.push(BestEditor()); | 55 results.push(BestEditor()); |
57 Debug.setListener(null); | 56 Debug.setListener(null); |
58 | 57 |
59 assertNull(exception); | 58 assertNull(exception); |
60 assertEquals(["Emacs", "Eclipse", "Vim"], results); | 59 assertEquals(["Emacs", "Eclipse", "Vim"], results); |
61 print(JSON.stringify(log, 1)); | 60 print(JSON.stringify(log, 1)); |
62 assertEquals([ | 61 assertEquals([ |
63 "debugger;", | 62 "debugger;", |
64 "results.push(BestEditor());", | 63 "results.push(BestEditor());", |
65 " var best_editor = \"Emacs\";", | 64 " return 'Emacs';","}", |
66 " return best_editor;","}", | |
67 "results.push(BestEditor());", | 65 "results.push(BestEditor());", |
68 "results.push(BestEditor());", | 66 "results.push(BestEditor());", |
69 " var best_editor = \"Emacs\";", | 67 " return 'Emacs';", |
70 " return best_editor;", | 68 " return 'Eclipse';","}", |
71 " var best_editor = \"Eclipse\";", | |
72 " return best_editor;","}", | |
73 "results.push(BestEditor());", | 69 "results.push(BestEditor());", |
74 "results.push(BestEditor());", | 70 "results.push(BestEditor());", |
75 " var best_editor = \"Eclipse\";", | 71 " return 'Eclipse';", |
76 " return best_editor;", | 72 " return 'Vim';", |
77 " var best_editor = \"Vim\";", | |
78 " return best_editor;", | |
79 "}","results.push(BestEditor());", | 73 "}","results.push(BestEditor());", |
80 "Debug.setListener(null);" | 74 "Debug.setListener(null);" |
81 ], log); | 75 ], log); |
OLD | NEW |