From b12e6baa664fa23ac2901ca9a4f3d56df1e6b787 Mon Sep 17 00:00:00 2001 From: isaacs Date: Sat, 25 Feb 2023 15:47:20 -0800 Subject: [PATCH] slashes on nodir test --- test/nodir.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/nodir.ts b/test/nodir.ts index 2c4fc676..cd4dfa9b 100644 --- a/test/nodir.ts +++ b/test/nodir.ts @@ -1,16 +1,20 @@ -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', @@ -18,12 +22,12 @@ const cases: [string, GlobOptions, string[]][] = [ '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' }, []],