Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: test/debugger/debug/debug-evaluate-no-side-effect-builtins.js

Issue 2695933005: [debugger] extend side effect free debug-evaluate to Array builtins. (Closed)
Patch Set: fix Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/debug/debug-evaluate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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, 15 assertEquals(expectation,
16 exec_state.frame(0).evaluate(source, true).value()); 16 exec_state.frame(0).evaluate(source, true).value());
17 } 17 }
18 function fail(source) { 18 function fail(source) {
19 assertThrows(() => exec_state.frame(0).evaluate(source, true), 19 assertThrows(() => exec_state.frame(0).evaluate(source, true),
20 EvalError); 20 EvalError);
21 } 21 }
22 22
23 // Test Array functions.
24 var function_param = [
25 "forEach", "every", "some", "reduce", "reduceRight", "find", "filter",
26 "map", "findIndex"
27 ];
28 var fails = ["toString", "join", "toLocaleString", "pop", "push",
29 "reverse", "shift", "unshift", "slice", "splice", "sort", "filter",
30 "map", "copyWithin", "fill", "concat"];
31 for (f of Object.getOwnPropertyNames(Array.prototype)) {
32 if (typeof Array.prototype[f] === "function") {
33 if (fails.includes(f)) {
34 if (function_param.includes(f)) {
35 fail(`[1, 2, 3].${f}(()=>{});`);
36 } else {
37 fail(`[1, 2, 3].${f}();`);
38 }
39 } else if (function_param.includes(f)) {
40 exec_state.frame(0).evaluate(`[1, 2, 3].${f}(()=>{});`, true);
41 } else {
42 exec_state.frame(0).evaluate(`[1, 2, 3].${f}();`, true);
43 }
44 }
45 }
46
23 // Test Math functions. 47 // Test Math functions.
24 for (f of Object.getOwnPropertyNames(Math)) { 48 for (f of Object.getOwnPropertyNames(Math)) {
25 if (typeof Math[f] === "function") { 49 if (typeof Math[f] === "function") {
26 var result = exec_state.frame(0).evaluate( 50 var result = exec_state.frame(0).evaluate(
27 `Math.${f}(0.5, -0.5);`).value(); 51 `Math.${f}(0.5, -0.5);`, true).value();
28 if (f != "random") assertEquals(Math[f](0.5, -0.5), result); 52 if (f != "random") assertEquals(Math[f](0.5, -0.5), result);
29 } 53 }
30 } 54 }
31 55
32 // Test Number functions. 56 // Test Number functions.
33 for (f of Object.getOwnPropertyNames(Number)) { 57 for (f of Object.getOwnPropertyNames(Number)) {
34 if (typeof Number[f] === "function") { 58 if (typeof Number[f] === "function") {
35 success(Number[f](0.5), `Number.${f}(0.5);`); 59 success(Number[f](0.5), `Number.${f}(0.5);`);
36 } 60 }
37 } 61 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Add the debug event listener. 106 // Add the debug event listener.
83 Debug.setListener(listener); 107 Debug.setListener(listener);
84 108
85 function f() { 109 function f() {
86 debugger; 110 debugger;
87 }; 111 };
88 112
89 f(); 113 f();
90 114
91 assertNull(exception); 115 assertNull(exception);
OLDNEW
« no previous file with comments | « src/debug/debug-evaluate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698