Skip to content

Commit

Permalink
Modifying these RegExp tests to not care about enumerability.
Browse files Browse the repository at this point in the history
In Opera 12, for example, most of these properties aren't enumerable.
  • Loading branch information
ljharb committed Feb 5, 2015
1 parent 3b88c67 commit 91c5bb8
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions test/regexp.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,40 +132,34 @@ describe('RegExp', function () {
});

it('has "input" property', function () {
expect(Object.getOwnPropertyNames(RegExp)).to.include('input');
expect(Object.getOwnPropertyNames(RegExp)).to.include('$_');
expect(Object.keys(RegExp)).not.to.include('$_');
expect(RegExp).to.have.ownProperty('input');
expect(RegExp).to.have.ownProperty('$_');
});

it('has "last match" property', function () {
expect(Object.getOwnPropertyNames(RegExp)).to.include('lastMatch');
expect(Object.getOwnPropertyNames(RegExp)).to.include('$+');
expect(Object.keys(RegExp)).not.to.include('$+');
expect(RegExp).to.have.ownProperty('lastMatch');
expect(RegExp).to.have.ownProperty('$+');
});

it('has "last paren" property', function () {
expect(Object.getOwnPropertyNames(RegExp)).to.include('lastParen');
expect(Object.getOwnPropertyNames(RegExp)).to.include('$&');
expect(Object.keys(RegExp)).not.to.include('$&');
expect(RegExp).to.have.ownProperty('lastParen');
expect(RegExp).to.have.ownProperty('$&');
});

it('has "leftContext" property', function () {
expect(Object.getOwnPropertyNames(RegExp)).to.include('leftContext');
expect(Object.getOwnPropertyNames(RegExp)).to.include('$`');
expect(Object.keys(RegExp)).not.to.include('$`');
expect(RegExp).to.have.ownProperty('leftContext');
expect(RegExp).to.have.ownProperty('$`');
});

it('has "rightContext" property', function () {
expect(Object.getOwnPropertyNames(RegExp)).to.include('rightContext');
expect(Object.getOwnPropertyNames(RegExp)).to.include("$'");
expect(Object.keys(RegExp)).not.to.include("$'");
expect(RegExp).to.have.ownProperty('rightContext');
expect(RegExp).to.have.ownProperty("$'");
});

xit('has "multiline" property', function () {
// fails in IE 9, 10, 11
expect(Object.getOwnPropertyNames(RegExp)).to.include('multiline');
expect(Object.getOwnPropertyNames(RegExp)).to.include('$*');
expect(Object.keys(RegExp)).not.to.include('$*');
expect(RegExp).to.have.ownProperty('multiline');
expect(RegExp).to.have.ownProperty('$*');
});

it('has the right globals', function () {
Expand Down

0 comments on commit 91c5bb8

Please sign in to comment.