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 object_with_symbol_key = {[Symbol("a")]: 1}; | 10 var object_with_symbol_key = {[Symbol("a")]: 1}; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 success(Number(0.5)[f](5), `Number(0.5).${f}(5);`); | 102 success(Number(0.5)[f](5), `Number(0.5).${f}(5);`); |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 // Test String functions. | 106 // Test String functions. |
107 success(" ", "String.fromCodePoint(0x20)"); | 107 success(" ", "String.fromCodePoint(0x20)"); |
108 success(" ", "String.fromCharCode(0x20)"); | 108 success(" ", "String.fromCharCode(0x20)"); |
109 for (f of Object.getOwnPropertyNames(String.prototype)) { | 109 for (f of Object.getOwnPropertyNames(String.prototype)) { |
110 if (typeof String.prototype[f] === "function") { | 110 if (typeof String.prototype[f] === "function") { |
111 // Do not expect locale-specific or regexp-related functions to work. | 111 // Do not expect locale-specific or regexp-related functions to work. |
112 // {Lower,Upper}Case (Locale-specific or not) do not work either. | 112 // {Lower,Upper}Case (Locale-specific or not) do not work either |
| 113 // if Intl is enabled. |
113 if (f.indexOf("locale") >= 0) continue; | 114 if (f.indexOf("locale") >= 0) continue; |
114 if (f.indexOf("Lower") >= 0) continue; | 115 if (f.indexOf("Locale") >= 0) continue; |
115 if (f.indexOf("Upper") >= 0) continue; | 116 if (typeof Intl !== 'undefined') { |
| 117 if (f == "toUpperCase") continue; |
| 118 if (f == "toLowerCase") continue; |
| 119 } |
116 if (f == "normalize") continue; | 120 if (f == "normalize") continue; |
117 if (f == "match") continue; | 121 if (f == "match") continue; |
118 if (f == "search") continue; | 122 if (f == "search") continue; |
119 if (f == "split" || f == "replace") { | 123 if (f == "split" || f == "replace") { |
120 fail(`'abcd'.${f}(2)`); | 124 fail(`'abcd'.${f}(2)`); |
121 continue; | 125 continue; |
122 } | 126 } |
123 success("abcd"[f](2), `"abcd".${f}(2);`); | 127 success("abcd"[f](2), `"abcd".${f}(2);`); |
124 } | 128 } |
125 } | 129 } |
126 fail("'abCd'.toLowerCase()"); | |
127 fail("'abcd'.toUpperCase()"); | |
128 fail("'abCd'.toLocaleLowerCase()"); | 130 fail("'abCd'.toLocaleLowerCase()"); |
129 fail("'abcd'.toLocaleUpperCase()"); | 131 fail("'abcd'.toLocaleUpperCase()"); |
| 132 if (typeof Intl !== 'undefined') { |
| 133 fail("'abCd'.toLowerCase()"); |
| 134 fail("'abcd'.toUpperCase()"); |
| 135 } |
130 fail("'abcd'.match(/a/)"); | 136 fail("'abcd'.match(/a/)"); |
131 fail("'abcd'.replace(/a/)"); | 137 fail("'abcd'.replace(/a/)"); |
132 fail("'abcd'.search(/a/)"); | 138 fail("'abcd'.search(/a/)"); |
133 fail("'abcd'.split(/a/)"); | 139 fail("'abcd'.split(/a/)"); |
134 | 140 |
135 // Test JSON functions. | 141 // Test JSON functions. |
136 success('{"abc":[1,2]}', "JSON.stringify(JSON.parse('{\"abc\":[1,2]}'))"); | 142 success('{"abc":[1,2]}', "JSON.stringify(JSON.parse('{\"abc\":[1,2]}'))"); |
137 | 143 |
138 // Test Symbol functions. | 144 // Test Symbol functions. |
139 success(undefined, `Symbol("a")`); | 145 success(undefined, `Symbol("a")`); |
(...skipping 10 matching lines...) Expand all Loading... |
150 // Add the debug event listener. | 156 // Add the debug event listener. |
151 Debug.setListener(listener); | 157 Debug.setListener(listener); |
152 | 158 |
153 function f() { | 159 function f() { |
154 debugger; | 160 debugger; |
155 }; | 161 }; |
156 | 162 |
157 f(); | 163 f(); |
158 | 164 |
159 assertNull(exception); | 165 assertNull(exception); |
OLD | NEW |