OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 var log = []; |
| 6 |
| 7 var fake = { |
| 8 pattern: function() { |
| 9 log.push("p"); |
| 10 return { |
| 11 toString: function() { |
| 12 log.push("ps"); |
| 13 return "pattern"; |
| 14 } |
| 15 }; |
| 16 }, |
| 17 flags: function() { |
| 18 log.push("f"); |
| 19 return { |
| 20 toString: function() { |
| 21 log.push("fs"); |
| 22 return "flags"; |
| 23 } |
| 24 }; |
| 25 } |
| 26 } |
| 27 |
| 28 assertThrows(() => RegExp.prototype.toString.call(1)); |
| 29 assertEquals("/pattern/flags", RegExp.prototype.toString.call(fake)); |
| 30 assertEquals(["p", "ps", "f", "fs"], log); |
OLD | NEW |