-
Notifications
You must be signed in to change notification settings - Fork 3.5k
/
ident.js
27 lines (21 loc) · 743 Bytes
/
ident.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
'use strict';
const hljs = require('../../build');
const pattern = new RegExp(`^${hljs.IDENT_RE}$`);
describe('.IDENT_RE', () => {
it('should match non-underscore starting words', () => {
const words = [ 'foo' , 'bar' , 'baz'
, 'Foo' , 'Bar' , 'Baz'
, 'f_oo', 'ba_r', 'baz_'
, 'F_oo', 'Ba_r', 'Baz_'
];
words.should.matchEach(pattern);
});
it('should not match underscore starting words', () => {
const words = [ '_foo' , '_bar' , '_baz'
, '_Foo' , '_Bar' , '_Baz'
, '_f_oo', '_ba_r', '_baz_'
, '_F_oo', '_Ba_r', '_Baz_'
];
words.should.not.matchEach(pattern);
});
});