2a09d1a4
liuqimichale
添加宜春 天水 宣化
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
/* 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(String(/pattern/)).toBe('/pattern/');
expect(String(/pattern/i)).toBe('/pattern/i');
expect(String(/pattern/mi)).toBe('/pattern/im');
expect(String(/pattern/im)).toBe('/pattern/im');
expect(String(/pattern/mgi)).toBe('/pattern/gim');
});
});
describe('objects', function () {
it('should return correct flags and in correct order', function () {
expect(String(new RegExp('pattern'))).toBe('/pattern/');
expect(String(new RegExp('pattern', 'i'))).toBe('/pattern/i');
expect(String(new RegExp('pattern', 'mi'))).toBe('/pattern/im');
expect(String(new RegExp('pattern', 'im'))).toBe('/pattern/im');
expect(String(new RegExp('pattern', 'mgi'))).toBe('/pattern/gim');
});
});
});
});
|