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 | 10 |
11 function listener(event, exec_state, event_data, data) { | 11 function listener(event, exec_state, event_data, data) { |
12 if (event != Debug.DebugEvent.Break) return; | 12 if (event != Debug.DebugEvent.Break) return; |
13 try { | 13 try { |
14 function success(expectation, source) { | 14 function success(expectation, source) { |
15 assertEquals(expectation, exec_state.frame(0).evaluate(source).value()); | 15 assertEquals(expectation, |
| 16 exec_state.frame(0).evaluate(source, true).value()); |
16 } | 17 } |
17 function fail(source) { | 18 function fail(source) { |
18 assertThrows(() => exec_state.frame(0).evaluate(source), EvalError); | 19 assertThrows(() => exec_state.frame(0).evaluate(source, true), |
| 20 EvalError); |
19 } | 21 } |
20 | 22 |
21 // Test Math functions. | 23 // Test Math functions. |
22 for (f of Object.getOwnPropertyNames(Math)) { | 24 for (f of Object.getOwnPropertyNames(Math)) { |
23 if (typeof Math[f] === "function") { | 25 if (typeof Math[f] === "function") { |
24 var result = exec_state.frame(0).evaluate( | 26 var result = exec_state.frame(0).evaluate( |
25 `Math.${f}(0.5, -0.5);`).value(); | 27 `Math.${f}(0.5, -0.5);`).value(); |
26 if (f != "random") assertEquals(Math[f](0.5, -0.5), result); | 28 if (f != "random") assertEquals(Math[f](0.5, -0.5), result); |
27 } | 29 } |
28 } | 30 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Add the debug event listener. | 82 // Add the debug event listener. |
81 Debug.setListener(listener); | 83 Debug.setListener(listener); |
82 | 84 |
83 function f() { | 85 function f() { |
84 debugger; | 86 debugger; |
85 }; | 87 }; |
86 | 88 |
87 f(); | 89 f(); |
88 | 90 |
89 assertNull(exception); | 91 assertNull(exception); |
OLD | NEW |