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 --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 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 success(Number(0.5)[f](5), `Number(0.5).${f}(5);`); | 39 success(Number(0.5)[f](5), `Number(0.5).${f}(5);`); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 // Test String functions. | 43 // Test String functions. |
44 success(" ", "String.fromCodePoint(0x20)"); | 44 success(" ", "String.fromCodePoint(0x20)"); |
45 success(" ", "String.fromCharCode(0x20)"); | 45 success(" ", "String.fromCharCode(0x20)"); |
46 for (f of Object.getOwnPropertyNames(String.prototype)) { | 46 for (f of Object.getOwnPropertyNames(String.prototype)) { |
47 if (typeof String.prototype[f] === "function") { | 47 if (typeof String.prototype[f] === "function") { |
48 // Do not expect locale-specific or regexp-related functions to work. | 48 // Do not expect locale-specific or regexp-related functions to work. |
| 49 // {Lower,Upper}Case (Locale-specific or not) do not work either. |
49 if (f.indexOf("locale") >= 0) continue; | 50 if (f.indexOf("locale") >= 0) continue; |
| 51 if (f.indexOf("Lower") >= 0) continue; |
| 52 if (f.indexOf("Upper") >= 0) continue; |
50 if (f == "normalize") continue; | 53 if (f == "normalize") continue; |
51 if (f == "match") continue; | 54 if (f == "match") continue; |
52 if (f == "search") continue; | 55 if (f == "search") continue; |
53 if (f == "split") continue; | 56 if (f == "split") continue; |
54 success("abcd"[f](2), `"abcd".${f}(2);`); | 57 success("abcd"[f](2), `"abcd".${f}(2);`); |
55 } | 58 } |
56 } | 59 } |
| 60 fail("'abCd'.toLowerCase()"); |
| 61 fail("'abcd'.toUpperCase()"); |
| 62 fail("'abCd'.toLocaleLowerCase()"); |
| 63 fail("'abcd'.toLocaleUpperCase()"); |
57 fail("'abcd'.match(/a/)"); | 64 fail("'abcd'.match(/a/)"); |
58 fail("'abcd'.replace(/a/)"); | 65 fail("'abcd'.replace(/a/)"); |
59 fail("'abcd'.search(/a/)"); | 66 fail("'abcd'.search(/a/)"); |
60 fail("'abcd'.split(/a/)"); | 67 fail("'abcd'.split(/a/)"); |
61 | 68 |
62 // Test JSON functions. | 69 // Test JSON functions. |
63 success('{"abc":[1,2]}', "JSON.stringify(JSON.parse('{\"abc\":[1,2]}'))"); | 70 success('{"abc":[1,2]}', "JSON.stringify(JSON.parse('{\"abc\":[1,2]}'))"); |
64 } catch (e) { | 71 } catch (e) { |
65 exception = e; | 72 exception = e; |
66 print(e, e.stack); | 73 print(e, e.stack); |
67 }; | 74 }; |
68 }; | 75 }; |
69 | 76 |
70 // Add the debug event listener. | 77 // Add the debug event listener. |
71 Debug.setListener(listener); | 78 Debug.setListener(listener); |
72 | 79 |
73 function f() { | 80 function f() { |
74 debugger; | 81 debugger; |
75 }; | 82 }; |
76 | 83 |
77 f(); | 84 f(); |
78 | 85 |
79 assertNull(exception); | 86 assertNull(exception); |
OLD | NEW |