Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Fix the RegExp restoration tests #316

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions tests/sanity.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ var leftContext = RegExp.leftContext;
var input = RegExp.input;
var lastMatch = RegExp.lastMatch;
new IntlPolyfill.NumberFormat('de-DE');
assert(RegExp.leftContext, leftContext, 'RegExp.leftContext restored');
assert(RegExp.input, input, 'RegExp.input restored');
assert(RegExp.lastMatch, lastMatch, 'RegExp.lastMatch restored');
// Since the console.log implementation used by the assert function can modifiy the RegExp,
// we have to store the results before asserting them
var actualLeftContext = RegExp.leftContext;
var actualInput = RegExp.input;
var actualLastMatch = RegExp.lastMatch;
assert(actualLeftContext, leftContext, 'RegExp.leftContext restored');
assert(actualInput, input, 'RegExp.input restored');
assert(actualLastMatch, lastMatch, 'RegExp.lastMatch restored');
'a'.match(/a/);

// Issues #190, #192
Expand Down