Skip to content

Commit a597d9e

Browse files
committed
🔧 fix main, add test
1 parent 2b2b68f commit a597d9e

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "re2js-legendary",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "a node v0.10 compatible build of RE2JS",
5-
"main": "index.js",
5+
"main": "index.cjs",
66
"scripts": {
77
"lint": "eslint .",
88
"test": "mocha test/**/*.cjs"

‎test/test.cjs

+14
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,18 @@ describe('re2js', function() {
99
assert.ok(RE2JS.matches('ab+c', 'abbbc'));
1010
assert.ok(!RE2JS.matches('ab+c', 'cbbba'));
1111
});
12+
13+
it('should work with regexp', function() {
14+
var re = /yee/;
15+
var p = RE2JS.compile(re.source);
16+
assert.ok(p.matches('yee'));
17+
});
18+
19+
it('should work with flags', function() {
20+
var re = /yee/i;
21+
var flags = re.flags.indexOf('i') >= 0 ? RE2JS.CASE_INSENSITIVE : null;
22+
var p = RE2JS.compile(re.source, flags);
23+
assert.ok(p.matches('yee'));
24+
assert.ok(p.matches('YEE'));
25+
});
1226
});

0 commit comments

Comments
 (0)