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

Unified Diff: test/mjsunit/messages.js

Issue 1126043004: Migrate error messages, part 10. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixed and rebased 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-serialize.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/messages.js
diff --git a/test/mjsunit/messages.js b/test/mjsunit/messages.js
index 73cc15ac406e349058b4a5ac6be5f7726aa1c3f3..56470b1e5e7cc14ee0c4c355b9cb7c39967187ba 100644
--- a/test/mjsunit/messages.js
+++ b/test/mjsunit/messages.js
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// Flags: --stack-size=100 --harmony --harmony-reflect --harmony-arrays
-// Flags: --harmony-regexps
+// Flags: --harmony-regexps --strong-mode
function test(f, expected, type) {
try {
@@ -62,11 +62,30 @@ test(function() {
Array.prototype.shift.call(null);
}, "Array.prototype.shift called on null or undefined", TypeError);
+// kCannotPreventExtExternalArray
+test(function() {
+ Object.preventExtensions(new Uint16Array(1));
+}, "Cannot prevent extension of an object with external array elements", TypeError);
+
+// kConstAssign
+test(function() {
+ "use strict";
+ const a = 1;
+ a = 2;
+}, "Assignment to constant variable.", TypeError);
+
// kCannotConvertToPrimitive
test(function() {
[].join(Object(Symbol(1)));
}, "Cannot convert object to primitive value", TypeError);
+// kCircularStructure
+test(function() {
+ var o = {};
+ o.o = o;
+ JSON.stringify(o);
+}, "Converting circular structure to JSON", TypeError);
+
// kConstructorNotFunction
test(function() {
Uint16Array(1);
@@ -160,6 +179,11 @@ test(function() {
new Symbol();
}, "Symbol is not a constructor", TypeError);
+// kNotDateObject
+test(function() {
+ Date.prototype.setHours.call(1);
+}, "this is not a Date object.", TypeError);
+
// kNotGeneric
test(function() {
String.prototype.toString.call(1);
@@ -204,6 +228,14 @@ test(function() {
Object.defineProperty({}, "x", { get: 1 });
}, "Getter must be a function: 1", TypeError);
+// kObjectNotExtensible
+test(function() {
+ "use strict";
+ var o = {};
+ Object.freeze(o);
+ o.a = 1;
+}, "Can't add property a, object is not extensible", TypeError);
+
// kObjectSetterExpectingFunction
test(function() {
({}).__defineSetter__("x", 0);
@@ -248,6 +280,34 @@ test(function() {
new Promise(1);
}, "Promise resolver 1 is not a function", TypeError);
+// kStrictDeleteProperty
+test(function() {
+ "use strict";
+ var o = {};
+ Object.defineProperty(o, "p", { value: 1, writable: false });
+ delete o.p;
+}, "Cannot delete property 'p' of #<Object>", TypeError);
+
+// kStrictPoisonPill
+test(function() {
+ "use strict";
+ arguments.callee;
+}, "'caller', 'callee', and 'arguments' properties may not be accessed on " +
+ "strict mode functions or the arguments objects for calls to them",
+ TypeError);
+
+// kStrictReadOnlyProperty
+test(function() {
+ "use strict";
+ (1).a = 1;
+}, "Cannot assign to read only property 'a' of 1", TypeError);
+
+// kStrongImplicitCast
+test(function() {
+ "use strong";
+ "a" + 1;
+}, "In strong mode, implicit conversions are deprecated", TypeError);
+
// kSymbolToPrimitive
test(function() {
1 + Object(Symbol());
« 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