A fork of https://github.com/ueokande/vim-vixen
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
657 B
20 lines
657 B
7 years ago
|
import * as re from 'shared/utils/re';
|
||
|
|
||
|
describe("re util", () => {
|
||
|
it('matches by pattern', () => {
|
||
|
let regex = re.fromWildcard('*.example.com/*');
|
||
|
expect('foo.example.com/bar').to.match(regex);
|
||
|
expect('foo.example.com').not.to.match(regex);
|
||
|
expect('example.com/bar').not.to.match(regex);
|
||
|
|
||
|
regex = re.fromWildcard('example.com/*')
|
||
|
expect('example.com/foo').to.match(regex);
|
||
|
expect('example.com/').to.match(regex);
|
||
|
|
||
|
regex = re.fromWildcard('example.com/*bar')
|
||
|
expect('example.com/foobar').to.match(regex);
|
||
|
expect('example.com/bar').to.match(regex);
|
||
|
expect('example.com/foobarfoo').not.to.match(regex);
|
||
|
})
|
||
|
});
|