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

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

Issue 1130073005: Revert of Migrate error messages, part 10. (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 | « test/cctest/test-serialize.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 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 --strong-mode 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();
11 } catch (e) { 11 } catch (e) {
12 assertInstanceof(e, type); 12 assertInstanceof(e, type);
13 assertEquals(expected, e.message); 13 assertEquals(expected, e.message);
14 return; 14 return;
15 } 15 }
16 assertUnreachable("Exception expected"); 16 assertUnreachable("Exception expected");
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // kCalledOnNonObject 55 // kCalledOnNonObject
56 test(function() { 56 test(function() {
57 Object.defineProperty(1, "x", {}); 57 Object.defineProperty(1, "x", {});
58 }, "Object.defineProperty called on non-object", TypeError); 58 }, "Object.defineProperty called on non-object", TypeError);
59 59
60 // kCalledOnNullOrUndefined 60 // kCalledOnNullOrUndefined
61 test(function() { 61 test(function() {
62 Array.prototype.shift.call(null); 62 Array.prototype.shift.call(null);
63 }, "Array.prototype.shift called on null or undefined", TypeError); 63 }, "Array.prototype.shift called on null or undefined", TypeError);
64 64
65 // kCannotPreventExtExternalArray
66 test(function() {
67 Object.preventExtensions(new Uint16Array(1));
68 }, "Cannot prevent extension of an object with external array elements", TypeErr or);
69
70 // kConstAssign
71 test(function() {
72 "use strict";
73 const a = 1;
74 a = 2;
75 }, "Assignment to constant variable.", TypeError);
76
77 // kCannotConvertToPrimitive 65 // kCannotConvertToPrimitive
78 test(function() { 66 test(function() {
79 [].join(Object(Symbol(1))); 67 [].join(Object(Symbol(1)));
80 }, "Cannot convert object to primitive value", TypeError); 68 }, "Cannot convert object to primitive value", TypeError);
81 69
82 // kCircularStructure
83 test(function() {
84 var o = {};
85 o.o = o;
86 JSON.stringify(o);
87 }, "Converting circular structure to JSON", TypeError);
88
89 // kConstructorNotFunction 70 // kConstructorNotFunction
90 test(function() { 71 test(function() {
91 Uint16Array(1); 72 Uint16Array(1);
92 }, "Constructor Uint16Array requires 'new'", TypeError); 73 }, "Constructor Uint16Array requires 'new'", TypeError);
93 74
94 // kDataViewNotArrayBuffer 75 // kDataViewNotArrayBuffer
95 test(function() { 76 test(function() {
96 new DataView(1); 77 new DataView(1);
97 }, "First argument to DataView constructor must be an ArrayBuffer", TypeError); 78 }, "First argument to DataView constructor must be an ArrayBuffer", TypeError);
98 79
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // kNotAPromise 153 // kNotAPromise
173 test(function() { 154 test(function() {
174 Promise.prototype.chain.call(1); 155 Promise.prototype.chain.call(1);
175 }, "1 is not a promise", TypeError); 156 }, "1 is not a promise", TypeError);
176 157
177 // kNotConstructor 158 // kNotConstructor
178 test(function() { 159 test(function() {
179 new Symbol(); 160 new Symbol();
180 }, "Symbol is not a constructor", TypeError); 161 }, "Symbol is not a constructor", TypeError);
181 162
182 // kNotDateObject
183 test(function() {
184 Date.prototype.setHours.call(1);
185 }, "this is not a Date object.", TypeError);
186
187 // kNotGeneric 163 // kNotGeneric
188 test(function() { 164 test(function() {
189 String.prototype.toString.call(1); 165 String.prototype.toString.call(1);
190 }, "String.prototype.toString is not generic", TypeError); 166 }, "String.prototype.toString is not generic", TypeError);
191 167
192 test(function() { 168 test(function() {
193 String.prototype.valueOf.call(1); 169 String.prototype.valueOf.call(1);
194 }, "String.prototype.valueOf is not generic", TypeError); 170 }, "String.prototype.valueOf is not generic", TypeError);
195 171
196 test(function() { 172 test(function() {
(...skipping 24 matching lines...) Expand all
221 // kObjectGetterExpectingFunction 197 // kObjectGetterExpectingFunction
222 test(function() { 198 test(function() {
223 ({}).__defineGetter__("x", 0); 199 ({}).__defineGetter__("x", 0);
224 }, "Object.prototype.__defineGetter__: Expecting function", TypeError); 200 }, "Object.prototype.__defineGetter__: Expecting function", TypeError);
225 201
226 // kObjectGetterCallable 202 // kObjectGetterCallable
227 test(function() { 203 test(function() {
228 Object.defineProperty({}, "x", { get: 1 }); 204 Object.defineProperty({}, "x", { get: 1 });
229 }, "Getter must be a function: 1", TypeError); 205 }, "Getter must be a function: 1", TypeError);
230 206
231 // kObjectNotExtensible
232 test(function() {
233 "use strict";
234 var o = {};
235 Object.freeze(o);
236 o.a = 1;
237 }, "Can't add property a, object is not extensible", TypeError);
238
239 // kObjectSetterExpectingFunction 207 // kObjectSetterExpectingFunction
240 test(function() { 208 test(function() {
241 ({}).__defineSetter__("x", 0); 209 ({}).__defineSetter__("x", 0);
242 }, "Object.prototype.__defineSetter__: Expecting function", TypeError); 210 }, "Object.prototype.__defineSetter__: Expecting function", TypeError);
243 211
244 // kObjectSetterCallable 212 // kObjectSetterCallable
245 test(function() { 213 test(function() {
246 Object.defineProperty({}, "x", { set: 1 }); 214 Object.defineProperty({}, "x", { set: 1 });
247 }, "Setter must be a function: 1", TypeError); 215 }, "Setter must be a function: 1", TypeError);
248 216
(...skipping 24 matching lines...) Expand all
273 // kReduceNoInitial 241 // kReduceNoInitial
274 test(function() { 242 test(function() {
275 [].reduce(function() {}); 243 [].reduce(function() {});
276 }, "Reduce of empty array with no initial value", TypeError); 244 }, "Reduce of empty array with no initial value", TypeError);
277 245
278 // kResolverNotAFunction 246 // kResolverNotAFunction
279 test(function() { 247 test(function() {
280 new Promise(1); 248 new Promise(1);
281 }, "Promise resolver 1 is not a function", TypeError); 249 }, "Promise resolver 1 is not a function", TypeError);
282 250
283 // kStrictDeleteProperty
284 test(function() {
285 "use strict";
286 var o = {};
287 Object.defineProperty(o, "p", { value: 1, writable: false });
288 delete o.p;
289 }, "Cannot delete property 'p' of #<Object>", TypeError);
290
291 // kStrictPoisonPill
292 test(function() {
293 "use strict";
294 arguments.callee;
295 }, "'caller', 'callee', and 'arguments' properties may not be accessed on " +
296 "strict mode functions or the arguments objects for calls to them",
297 TypeError);
298
299 // kStrictReadOnlyProperty
300 test(function() {
301 "use strict";
302 (1).a = 1;
303 }, "Cannot assign to read only property 'a' of 1", TypeError);
304
305 // kStrongImplicitCast
306 test(function() {
307 "use strong";
308 "a" + 1;
309 }, "In strong mode, implicit conversions are deprecated", TypeError);
310
311 // kSymbolToPrimitive 251 // kSymbolToPrimitive
312 test(function() { 252 test(function() {
313 1 + Object(Symbol()); 253 1 + Object(Symbol());
314 }, "Cannot convert a Symbol wrapper object to a primitive value", TypeError); 254 }, "Cannot convert a Symbol wrapper object to a primitive value", TypeError);
315 255
316 // kSymbolToString 256 // kSymbolToString
317 test(function() { 257 test(function() {
318 "" + Symbol(); 258 "" + Symbol();
319 }, "Cannot convert a Symbol value to a string", TypeError); 259 }, "Cannot convert a Symbol value to a string", TypeError);
320 260
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 Number(1).toString(100); 370 Number(1).toString(100);
431 }, "toString() radix argument must be between 2 and 36", RangeError); 371 }, "toString() radix argument must be between 2 and 36", RangeError);
432 372
433 373
434 // === URIError === 374 // === URIError ===
435 375
436 // kURIMalformed 376 // kURIMalformed
437 test(function() { 377 test(function() {
438 decodeURI("%%"); 378 decodeURI("%%");
439 }, "URI malformed", URIError); 379 }, "URI malformed", URIError);
OLDNEW
« no previous file with comments | « test/cctest/test-serialize.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698