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

Side by Side Diff: test/mjsunit/messages.js

Issue 1118273004: Migrate error messages, part 8. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/typedarray.js ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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: --stack-size=100 --harmony --harmony-reflect --harmony-arrays 5 // Flags: --stack-size=100 --harmony --harmony-reflect --harmony-arrays
6 // Flags: --harmony-regexps 6 // Flags: --harmony-regexps
7 7
8 function test(f, expected, type) { 8 function test(f, expected, type) {
9 try { 9 try {
10 f(); 10 f();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // kCannotConvertToPrimitive 65 // kCannotConvertToPrimitive
66 test(function() { 66 test(function() {
67 [].join(Object(Symbol(1))); 67 [].join(Object(Symbol(1)));
68 }, "Cannot convert object to primitive value", TypeError); 68 }, "Cannot convert object to primitive value", TypeError);
69 69
70 // kConstructorNotFunction 70 // kConstructorNotFunction
71 test(function() { 71 test(function() {
72 Uint16Array(1); 72 Uint16Array(1);
73 }, "Constructor Uint16Array requires 'new'", TypeError); 73 }, "Constructor Uint16Array requires 'new'", TypeError);
74 74
75 // kDataViewNotArrayBuffer
76 test(function() {
77 new DataView(1);
78 }, "First argument to DataView constructor must be an ArrayBuffer", TypeError);
79
75 // kDateType 80 // kDateType
76 test(function() { 81 test(function() {
77 Date.prototype.setYear.call({}, 1); 82 Date.prototype.setYear.call({}, 1);
78 }, "this is not a Date object.", TypeError); 83 }, "this is not a Date object.", TypeError);
79 84
80 // kDefineDisallowed 85 // kDefineDisallowed
81 test(function() { 86 test(function() {
82 "use strict"; 87 "use strict";
83 var o = {}; 88 var o = {};
84 Object.preventExtensions(o); 89 Object.preventExtensions(o);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 var obj = {}; 143 var obj = {};
139 obj[Symbol.iterator] = function() { return { next: function() { return 1 }}}; 144 obj[Symbol.iterator] = function() { return { next: function() { return 1 }}};
140 Array.from(obj); 145 Array.from(obj);
141 }, "Iterator result 1 is not an object", TypeError); 146 }, "Iterator result 1 is not an object", TypeError);
142 147
143 // kIteratorValueNotAnObject 148 // kIteratorValueNotAnObject
144 test(function() { 149 test(function() {
145 new Map([1]); 150 new Map([1]);
146 }, "Iterator value 1 is not an entry object", TypeError); 151 }, "Iterator value 1 is not an entry object", TypeError);
147 152
153 // kNotAPromise
154 test(function() {
155 Promise.prototype.chain.call(1);
156 }, "1 is not a promise", TypeError);
157
148 // kNotConstructor 158 // kNotConstructor
149 test(function() { 159 test(function() {
150 new Symbol(); 160 new Symbol();
151 }, "Symbol is not a constructor", TypeError); 161 }, "Symbol is not a constructor", TypeError);
152 162
153 // kNotGeneric 163 // kNotGeneric
154 test(function() { 164 test(function() {
155 String.prototype.toString.call(1); 165 String.prototype.toString.call(1);
156 }, "String.prototype.toString is not generic", TypeError); 166 }, "String.prototype.toString is not generic", TypeError);
157 167
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 var o = {}; 236 var o = {};
227 Object.defineProperty(o, "x", { value: 1, configurable: false }); 237 Object.defineProperty(o, "x", { value: 1, configurable: false });
228 Object.defineProperty(o, "x", { value: 2 }); 238 Object.defineProperty(o, "x", { value: 2 });
229 }, "Cannot redefine property: x", TypeError); 239 }, "Cannot redefine property: x", TypeError);
230 240
231 // kReduceNoInitial 241 // kReduceNoInitial
232 test(function() { 242 test(function() {
233 [].reduce(function() {}); 243 [].reduce(function() {});
234 }, "Reduce of empty array with no initial value", TypeError); 244 }, "Reduce of empty array with no initial value", TypeError);
235 245
246 // kResolverNotAFunction
247 test(function() {
248 new Promise(1);
249 }, "Promise resolver 1 is not a function", TypeError);
250
236 // kSymbolToPrimitive 251 // kSymbolToPrimitive
237 test(function() { 252 test(function() {
238 1 + Object(Symbol()); 253 1 + Object(Symbol());
239 }, "Cannot convert a Symbol wrapper object to a primitive value", TypeError); 254 }, "Cannot convert a Symbol wrapper object to a primitive value", TypeError);
240 255
241 // kSymbolToString 256 // kSymbolToString
242 test(function() { 257 test(function() {
243 "" + Symbol(); 258 "" + Symbol();
244 }, "Cannot convert a Symbol value to a string", TypeError); 259 }, "Cannot convert a Symbol value to a string", TypeError);
245 260
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 301
287 302
288 // === RangeError === 303 // === RangeError ===
289 304
290 // kArrayLengthOutOfRange 305 // kArrayLengthOutOfRange
291 test(function() { 306 test(function() {
292 "use strict"; 307 "use strict";
293 Object.defineProperty([], "length", { value: 1E100 }); 308 Object.defineProperty([], "length", { value: 1E100 });
294 }, "defineProperty() array length out of range", RangeError); 309 }, "defineProperty() array length out of range", RangeError);
295 310
311 // kInvalidArrayBufferLength
312 test(function() {
313 new ArrayBuffer(-1);
314 }, "Invalid array buffer length", RangeError);
315
316 // kInvalidArrayLength
317 test(function() {
318 [].length = -1;
319 }, "Invalid array length", RangeError);
320
296 // kInvalidCodePoint 321 // kInvalidCodePoint
297 test(function() { 322 test(function() {
298 String.fromCodePoint(-1); 323 String.fromCodePoint(-1);
299 }, "Invalid code point -1", RangeError); 324 }, "Invalid code point -1", RangeError);
300 325
301 // kInvalidCountValue 326 // kInvalidCountValue
302 test(function() { 327 test(function() {
303 "a".repeat(-1); 328 "a".repeat(-1);
304 }, "Invalid count value", RangeError); 329 }, "Invalid count value", RangeError);
305 330
331 // kInvalidArrayBufferLength
332 test(function() {
333 new Uint16Array(-1);
334 }, "Invalid typed array length", RangeError);
335
306 // kNormalizationForm 336 // kNormalizationForm
307 test(function() { 337 test(function() {
308 "".normalize("ABC"); 338 "".normalize("ABC");
309 }, "The normalization form should be one of NFC, NFD, NFKC, NFKD.", RangeError); 339 }, "The normalization form should be one of NFC, NFD, NFKC, NFKD.", RangeError);
310 340
311 // kNumberFormatRange 341 // kNumberFormatRange
312 test(function() { 342 test(function() {
313 Number(1).toFixed(100); 343 Number(1).toFixed(100);
314 }, "toFixed() digits argument must be between 0 and 20", RangeError); 344 }, "toFixed() digits argument must be between 0 and 20", RangeError);
315 345
(...skipping 17 matching lines...) Expand all
333 Number(1).toString(100); 363 Number(1).toString(100);
334 }, "toString() radix argument must be between 2 and 36", RangeError); 364 }, "toString() radix argument must be between 2 and 36", RangeError);
335 365
336 366
337 // === URIError === 367 // === URIError ===
338 368
339 // kURIMalformed 369 // kURIMalformed
340 test(function() { 370 test(function() {
341 decodeURI("%%"); 371 decodeURI("%%");
342 }, "URI malformed", URIError); 372 }, "URI malformed", URIError);
OLDNEW
« no previous file with comments | « src/typedarray.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698