1 /* global describe, it, expect */
3 describe('RegExp', function () {
6 describe('#toString()', function () {
7 describe('literals', function () {
8 it('should return correct flags and in correct order', function () {
9 expect(String(/pattern/)).toBe('/pattern/');
10 expect(String(/pattern/i)).toBe('/pattern/i');
11 expect(String(/pattern/mi)).toBe('/pattern/im');
12 expect(String(/pattern/im)).toBe('/pattern/im');
13 expect(String(/pattern/mgi)).toBe('/pattern/gim');
17 describe('objects', function () {
18 it('should return correct flags and in correct order', function () {
19 expect(String(new RegExp('pattern'))).toBe('/pattern/');
20 expect(String(new RegExp('pattern', 'i'))).toBe('/pattern/i');
21 expect(String(new RegExp('pattern', 'mi'))).toBe('/pattern/im');
22 expect(String(new RegExp('pattern', 'im'))).toBe('/pattern/im');
23 expect(String(new RegExp('pattern', 'mgi'))).toBe('/pattern/gim');