mirror of
https://github.com/tc39/test262.git
synced 2025-05-31 12:10:29 +02:00
18 lines
561 B
JavaScript
18 lines
561 B
JavaScript
// Copyright 2024 Leo Balter. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
esid: sec-regexp.escape
|
|
description: escape called with a RegExp object from another realm
|
|
features: [RegExp.escape, cross-realm]
|
|
---*/
|
|
|
|
const str = "oi+hello";
|
|
const other = $262.createRealm().global;
|
|
|
|
assert.sameValue(typeof other.RegExp.escape, "function", "other.RegExp.escape is a function");
|
|
|
|
const res = other.RegExp.escape.call(RegExp, str);
|
|
|
|
assert.sameValue(res, RegExp.escape(str), "cross-realm escape works correctly");
|