Skip to content

Commit

Permalink
slashes on nodir test
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Feb 27, 2023
1 parent 75f74b0 commit b12e6ba
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/nodir.ts
@@ -1,29 +1,33 @@
import { resolve } from 'path'
import { resolve, sep } from 'path'
import t from 'tap'
import glob from '../'
import type { GlobOptions } from '../src/index.js'
process.chdir(__dirname + '/fixtures')

const alphasort = (a: string, b: string) => a.localeCompare(b, 'en')
const j = (a: string[]) =>
a.map(s => s.split('/').join(sep)).sort(alphasort)

// [pattern, options, expect]
const root = resolve('a')
const cases: [string, GlobOptions, string[]][] = [
[
'*/**',
{ cwd: 'a' },
[
j([
'abcdef/g/h',
'abcfed/g/h',
'b/c/d',
'bc/e/f',
'c/d/c/b',
'cb/e/f',
'symlink/a/b/c',
],
]),
],
[
'a/*b*/**',
{},
['a/abcdef/g/h', 'a/abcfed/g/h', 'a/b/c/d', 'a/bc/e/f', 'a/cb/e/f'],
j(['a/abcdef/g/h', 'a/abcfed/g/h', 'a/b/c/d', 'a/bc/e/f', 'a/cb/e/f']),
],
['a/*b*/**/', {}, []],
['*/*', { cwd: 'a' }, []],
Expand Down

0 comments on commit b12e6ba

Please sign in to comment.