OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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: --ignition | 5 // Flags: --ignition --side-effect-free-debug-evaluate |
6 | 6 |
7 Debug = debug.Debug | 7 Debug = debug.Debug |
8 | 8 |
9 var exception = null; | 9 var exception = null; |
10 let a = 1; | 10 let a = 1; |
11 var object = { property : 2, | 11 var object = { property : 2, |
12 get getter() { return 3; } | 12 get getter() { return 3; } |
13 }; | 13 }; |
14 var string1 = { toString() { return "x"; } }; | 14 var string1 = { toString() { return "x"; } }; |
15 var string2 = { toString() { print("x"); return "x"; } }; | 15 var string2 = { toString() { print("x"); return "x"; } }; |
16 var array = [4, 5]; | 16 var array = [4, 5]; |
17 var error = new Error(); | 17 var error = new Error(); |
18 | 18 |
19 function set_a() { a = 2; } | 19 function set_a() { a = 2; } |
20 | 20 |
21 function get_a() { return a; } | 21 function get_a() { return a; } |
22 | 22 |
23 function listener(event, exec_state, event_data, data) { | 23 function listener(event, exec_state, event_data, data) { |
24 if (event != Debug.DebugEvent.Break) return; | 24 if (event != Debug.DebugEvent.Break) return; |
25 try { | 25 try { |
26 function success(expectation, source) { | 26 function success(expectation, source) { |
27 assertEquals(expectation, | 27 assertEquals(expectation, exec_state.frame(0).evaluate(source).value()); |
28 exec_state.frame(0).evaluate(source, true).value()); | |
29 } | 28 } |
30 function fail(source) { | 29 function fail(source) { |
31 assertThrows(() => exec_state.frame(0).evaluate(source, true), | 30 assertThrows(() => exec_state.frame(0).evaluate(source), EvalError); |
32 EvalError); | |
33 } | 31 } |
34 // Simple test. | 32 // Simple test. |
35 success(3, "1 + 2"); | 33 success(3, "1 + 2"); |
36 // Dymanic load. | 34 // Dymanic load. |
37 success(array, "array"); | 35 success(array, "array"); |
38 // Context load. | 36 // Context load. |
39 success(1, "a"); | 37 success(1, "a"); |
40 // Global and named property load. | 38 // Global and named property load. |
41 success(2, "object.property"); | 39 success(2, "object.property"); |
42 // Load via read-only getter. | 40 // Load via read-only getter. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 Debug.setListener(listener); | 74 Debug.setListener(listener); |
77 | 75 |
78 function f() { | 76 function f() { |
79 debugger; | 77 debugger; |
80 }; | 78 }; |
81 | 79 |
82 f(); | 80 f(); |
83 | 81 |
84 assertNull(exception); | 82 assertNull(exception); |
85 assertEquals(1, a); | 83 assertEquals(1, a); |
OLD | NEW |