-
-
Notifications
You must be signed in to change notification settings - Fork 810
/
Copy pathtest.js
46 lines (35 loc) · 901 Bytes
/
test.js
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict';
// MODULES //
var tape = require( 'tape' );
var RE = require( './../lib' );
// TESTS //
tape( 'main export is a regular expression', function test( t ) {
t.ok( true, __filename );
t.equal( RE instanceof RegExp, true, 'main export is a regular expression' );
t.end();
});
tape( 'the regular expression matches newline character sequences', function test( t ) {
var values;
var i;
values = [
'\r\n',
'\n'
];
for ( i = 0; i < values.length; i++ ) {
t.equal( RE.test( values[ i ] ), true, 'matches when provided '+values[i] );
}
t.end();
});
tape( 'the regular expression does not match escaped sequences or non-matching strings', function test( t ) {
var values;
var i;
values = [
'\\r\\n',
'\\n',
'beep'
];
for ( i = 0; i < values.length; i++ ) {
t.equal( RE.test( values[ i ] ), false, 'does not match when provided '+values[i] );
}
t.end();
});