Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / String / prototype / endsWith / return-abrupt-from-searchstring-regexp-test.js
blob165b14f6f1c5a49cac92b96735e86707182f836c
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 21.1.3.6
5 description: >
6   Returns abrupt from IsRegExp(searchString).
7 info: |
8   21.1.3.6 String.prototype.endsWith ( searchString [ , endPosition] )
10   ...
11   4. Let isRegExp be IsRegExp(searchString).
12   5. ReturnIfAbrupt(isRegExp).
13   ...
15   7.2.8 IsRegExp ( argument )
17   2. Let isRegExp be Get(argument, @@match).
18   3. ReturnIfAbrupt(isRegExp).
19 features: [Symbol.match, String.prototype.endsWith]
20 ---*/
22 var obj = {};
23 Object.defineProperty(obj, Symbol.match, {
24   get: function() {
25     throw new Test262Error();
26   }
27 });
29 assert.throws(Test262Error, function() {
30   ''.endsWith(obj);
31 });
33 var regexp = /./;
34 Object.defineProperty(regexp, Symbol.match, {
35   get: function() {
36     throw new Test262Error();
37   }
38 });
40 assert.throws(Test262Error, function() {
41   ''.endsWith(regexp);
42 });
44 reportCompare(0, 0);