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 --turbo | 5 // Flags: --ignition --turbo |
6 | 6 |
7 Debug = debug.Debug | 7 Debug = debug.Debug |
8 | 8 |
9 var exception = null; | 9 var exception = null; |
10 var date = new Date(); | 10 var date = new Date(); |
| 11 var map = new Map().set("a", "b").set("c", "d"); |
11 | 12 |
12 function listener(event, exec_state, event_data, data) { | 13 function listener(event, exec_state, event_data, data) { |
13 if (event != Debug.DebugEvent.Break) return; | 14 if (event != Debug.DebugEvent.Break) return; |
14 try { | 15 try { |
15 function success(expectation, source) { | 16 function success(expectation, source) { |
16 var result = exec_state.frame(0).evaluate(source, true).value(); | 17 var result = exec_state.frame(0).evaluate(source, true).value(); |
17 if (expectation !== undefined) assertEquals(expectation, result); | 18 if (expectation !== undefined) assertEquals(expectation, result); |
18 } | 19 } |
19 function fail(source) { | 20 function fail(source) { |
20 assertThrows(() => exec_state.frame(0).evaluate(source, true), | 21 assertThrows(() => exec_state.frame(0).evaluate(source, true), |
(...skipping 23 matching lines...) Expand all Loading... |
44 | 45 |
45 // Test global functions. | 46 // Test global functions. |
46 success(1, `parseInt("1")`); | 47 success(1, `parseInt("1")`); |
47 success(1.3, `parseFloat("1.3")`); | 48 success(1.3, `parseFloat("1.3")`); |
48 success("abc", `decodeURI("abc")`); | 49 success("abc", `decodeURI("abc")`); |
49 success("abc", `encodeURI("abc")`); | 50 success("abc", `encodeURI("abc")`); |
50 success("abc", `decodeURIComponent("abc")`); | 51 success("abc", `decodeURIComponent("abc")`); |
51 success("abc", `encodeURIComponent("abc")`); | 52 success("abc", `encodeURIComponent("abc")`); |
52 success("abc", `escape("abc")`); | 53 success("abc", `escape("abc")`); |
53 success("abc", `unescape("abc")`); | 54 success("abc", `unescape("abc")`); |
| 55 success(true, `isFinite(0)`); |
| 56 success(true, `isNaN(0/0)`); |
| 57 |
| 58 // Test Map functions. |
| 59 success(undefined, `new Map()`); |
| 60 success("[object Map]", `map.toString()`); |
| 61 success("b", `map.get("a")`); |
| 62 success(true, `map.get("x") === undefined`); |
| 63 success(undefined, `map.entries()`); |
| 64 success(undefined, `map.keys()`); |
| 65 success(undefined, `map.values()`); |
| 66 success(2, `map.size`); |
| 67 fail(`map.has("c")`); // This sets a hash on the object. |
| 68 fail(`map.forEach(()=>1)`); |
| 69 fail(`map.delete("a")`); |
| 70 fail(`map.clear()`); |
| 71 fail(`map.set("x", "y")`); |
54 } catch (e) { | 72 } catch (e) { |
55 exception = e; | 73 exception = e; |
56 print(e, e.stack); | 74 print(e, e.stack); |
57 }; | 75 }; |
58 }; | 76 }; |
59 | 77 |
60 // Add the debug event listener. | 78 // Add the debug event listener. |
61 Debug.setListener(listener); | 79 Debug.setListener(listener); |
62 | 80 |
63 function f() { | 81 function f() { |
64 debugger; | 82 debugger; |
65 }; | 83 }; |
66 | 84 |
67 f(); | 85 f(); |
68 | 86 |
69 assertNull(exception); | 87 assertNull(exception); |
OLD | NEW |