Index: test/mjsunit/es6/regexp-tostring.js |
diff --git a/test/mjsunit/es6/regexp-tostring.js b/test/mjsunit/es6/regexp-tostring.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d2e39eaab21ace4176f0f23e8450ae1284547ff6 |
--- /dev/null |
+++ b/test/mjsunit/es6/regexp-tostring.js |
@@ -0,0 +1,30 @@ |
+// Copyright 2016 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. |
+ |
+var log = []; |
+ |
+var fake = { |
+ pattern: function() { |
+ log.push("p"); |
+ return { |
+ toString: function() { |
+ log.push("ps"); |
+ return "pattern"; |
+ } |
+ }; |
+ }, |
+ flags: function() { |
+ log.push("f"); |
+ return { |
+ toString: function() { |
+ log.push("fs"); |
+ return "flags"; |
+ } |
+ }; |
+ } |
+} |
+ |
+assertThrows(() => RegExp.prototype.toString.call(1)); |
+assertEquals("/pattern/flags", RegExp.prototype.toString.call(fake)); |
+assertEquals(["p", "ps", "f", "fs"], log); |