Provide command to adjust phpunit.xml for code coverage
[lhc/web/wiklou.git] / tests / qunit / suites / resources / mediawiki / mediawiki.RegExp.test.js
1 ( function () {
2 QUnit.module( 'mediawiki.RegExp' );
3
4 QUnit.test( 'escape', function ( assert ) {
5 var specials, normal;
6
7 specials = [
8 '\\',
9 '{',
10 '}',
11 '(',
12 ')',
13 '[',
14 ']',
15 '|',
16 '.',
17 '?',
18 '*',
19 '+',
20 '-',
21 '^',
22 '$'
23 ];
24
25 normal = [
26 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
27 'abcdefghijklmnopqrstuvwxyz',
28 '0123456789'
29 ].join( '' );
30
31 specials.forEach( function ( str ) {
32 assert.propEqual( str.match( new RegExp( mw.RegExp.escape( str ) ) ), [ str ], 'Match ' + str );
33 } );
34
35 assert.strictEqual( mw.RegExp.escape( normal ), normal, 'Alphanumerals are left alone' );
36 } );
37
38 }() );