|
| 1 | +import t from 'tap' |
| 2 | +import { minimatch as mm } from '../src/index.js' |
| 3 | +import type { MMRegExp } from '../src/index.js' |
| 4 | + |
| 5 | +t.equal(mm('/a/b', '/*/b/x/y/z', { partial: true }), true) |
| 6 | +t.equal(mm('/a/b/c', '/*/b/x/y/z', { partial: true }), false) |
| 7 | +t.equal(mm('/', 'x', { partial: true }), true) |
| 8 | +const m = new mm.Minimatch('/*/b/x/y/z') |
| 9 | +t.equal(m.match('/a/b', true), true) |
| 10 | +t.equal(mm('/b/c/d/a', '/**/a/b/c', { partial: true }), true) |
| 11 | +t.equal(mm('/b/c/d/a', '/**/a/b/c/**', { partial: true }), true) |
| 12 | + |
| 13 | +t.equal(mm('a', 'a/**', { partial: true }), true) |
| 14 | +t.equal(mm('a', '**', { partial: true }), true) |
| 15 | +t.equal(mm('b/a', 'a/**', { partial: true }), false) |
| 16 | +t.equal(mm('/b/c/d/a', '/**/a/**/b/c/**', { partial: true }), true) |
| 17 | +t.equal(mm('/b/c/d/a', '/**/a/**', { partial: true }), true) |
| 18 | + |
| 19 | +t.equal( |
| 20 | + (mm.makeRe('/*/b/x/y/z', { partial: true }) as MMRegExp).test('/a/b'), |
| 21 | + true, |
| 22 | +) |
| 23 | +t.equal( |
| 24 | + (mm.makeRe('/*/b/x/y/z', { partial: true }) as MMRegExp).test('/a/b/c'), |
| 25 | + false, |
| 26 | +) |
| 27 | +t.equal((mm.makeRe('x', { partial: true }) as MMRegExp).test('/'), true) |
0 commit comments