-
-
Notifications
You must be signed in to change notification settings - Fork 894
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for RegExp, toString should return correct flags and in correct…
… order
- Loading branch information
Xotic750
committed
Dec 9, 2015
1 parent
568c3e3
commit ce03328
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* global describe, it, expect */ | ||
|
||
describe('RegExp', function () { | ||
'use strict'; | ||
|
||
describe('#toString()', function () { | ||
describe('literals', function () { | ||
it('should return correct flags and in correct order', function () { | ||
expect(/pattern/.toString()).toBe('/pattern/'); | ||
expect(/pattern/i.toString()).toBe('/pattern/i'); | ||
expect(/pattern/mi.toString()).toBe('/pattern/im'); | ||
expect(/pattern/im.toString()).toBe('/pattern/im'); | ||
expect(/pattern/mgi.toString()).toBe('/pattern/gim'); | ||
}); | ||
}); | ||
describe('objects', function () { | ||
it('should return correct flags and in correct order', function () { | ||
expect(new RegExp('pattern').toString()).toBe('/pattern/'); | ||
expect(new RegExp('pattern', 'i').toString()).toBe('/pattern/i'); | ||
expect(new RegExp('pattern', 'mi').toString()).toBe('/pattern/im'); | ||
expect(new RegExp('pattern', 'im').toString()).toBe('/pattern/im'); | ||
expect(new RegExp('pattern', 'mgi').toString()).toBe('/pattern/gim'); | ||
}); | ||
}); | ||
}); | ||
}); |