Version 1
[yaffs-website] / node_modules / es5-shim / tests / spec / s-regexp.js
1 /* global describe, it, expect */
2
3 describe('RegExp', function () {
4     'use strict';
5
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');
14             });
15         });
16
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');
24             });
25         });
26     });
27 });