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

Unified Diff: test/mjsunit/messages.js

Issue 1083083004: Reland "Migrate error messages, part 2." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix for layout test Created 5 years, 8 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 | « src/weak-collection.js ('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
new file mode 100644
index 0000000000000000000000000000000000000000..c2ba73600a51d9e62554f646dcb458981119b82c
--- /dev/null
+++ b/test/mjsunit/messages.js
@@ -0,0 +1,54 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function test(f, expected, type) {
+ try {
+ f();
+ assertUnreachable();
+ } catch (e) {
+ assertInstanceof(e, type);
+ assertEquals(expected, e.message);
+ }
+}
+
+// === Error ===
+
+// kCyclicProto
+test(function() {
+ var o = {};
+ o.__proto__ = o;
+}, "Cyclic __proto__ value", Error);
+
+
+// === TypeError ===
+
+// kGeneratorRunning
+test(function() {
+ var iter;
+ function* generator() { yield iter.next(); }
+ var iter = generator();
+ iter.next();
+}, "Generator is already running", TypeError);
+
+// kCalledNonCallable
+test(function() {
+ [].forEach(1);
+}, "1 is not a function", TypeError);
+
+// kIncompatibleMethodReceiver
+test(function() {
+ RegExp.prototype.compile.call(RegExp.prototype);
+}, "Method RegExp.prototype.compile called on incompatible receiver " +
+ "[object RegExp]", TypeError);
+
+// kPropertyNotFunction
+test(function() {
+ Set.prototype.add = 0;
+ new Set(1);
+}, "Property 'add' of object #<Set> is not a function", TypeError);
+
+// kWithExpression
+test(function() {
+ with (null) {}
+}, "null has no properties", TypeError);
« no previous file with comments | « src/weak-collection.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698