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 --side-effect-free-debug-evaluate | 5 // Flags: --ignition |
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, exec_state.frame(0).evaluate(source).value()); | 27 assertEquals(expectation, |
| 28 exec_state.frame(0).evaluate(source, true).value()); |
28 } | 29 } |
29 function fail(source) { | 30 function fail(source) { |
30 assertThrows(() => exec_state.frame(0).evaluate(source), EvalError); | 31 assertThrows(() => exec_state.frame(0).evaluate(source, true), |
| 32 EvalError); |
31 } | 33 } |
32 // Simple test. | 34 // Simple test. |
33 success(3, "1 + 2"); | 35 success(3, "1 + 2"); |
34 // Dymanic load. | 36 // Dymanic load. |
35 success(array, "array"); | 37 success(array, "array"); |
36 // Context load. | 38 // Context load. |
37 success(1, "a"); | 39 success(1, "a"); |
38 // Global and named property load. | 40 // Global and named property load. |
39 success(2, "object.property"); | 41 success(2, "object.property"); |
40 // Load via read-only getter. | 42 // Load via read-only getter. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 Debug.setListener(listener); | 76 Debug.setListener(listener); |
75 | 77 |
76 function f() { | 78 function f() { |
77 debugger; | 79 debugger; |
78 }; | 80 }; |
79 | 81 |
80 f(); | 82 f(); |
81 | 83 |
82 assertNull(exception); | 84 assertNull(exception); |
83 assertEquals(1, a); | 85 assertEquals(1, a); |
OLD | NEW |