Skip to content

Commit 2a6899d

Browse files
committed
fix: format rust and update ignore tests for cross-platform paths
1 parent 55a9174 commit 2a6899d

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/glob.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3487,7 +3487,11 @@ mod tests {
34873487
let results = glob.walk_sync();
34883488

34893489
// All results should start with "./" or ".\\" on Windows
3490-
let expected_prefix = if cfg!(target_os = "windows") { ".\\" } else { "./" };
3490+
let expected_prefix = if cfg!(target_os = "windows") {
3491+
".\\"
3492+
} else {
3493+
"./"
3494+
};
34913495
for result in &results {
34923496
assert!(
34933497
result.starts_with(expected_prefix),

tests/compat/ignore.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { describe, it, expect, beforeAll, afterAll } from 'vitest'
22
import { glob as nodeGlob } from 'glob'
3-
import { loadGloblin, createTestFixture, cleanupFixture, FixtureConfig } from '../harness'
3+
import {
4+
loadGloblin,
5+
createTestFixture,
6+
cleanupFixture,
7+
FixtureConfig,
8+
platformPaths,
9+
} from '../harness'
410
import * as path from 'path'
511

612
describe('ignore option compatibility', () => {
@@ -418,7 +424,7 @@ describe('ignore option compatibility', () => {
418424

419425
const results = await globlin.glob(tc.pattern, options)
420426
const sorted = results.sort()
421-
const expected = tc.expected.sort()
427+
const expected = platformPaths(tc.expected).sort()
422428

423429
expect(sorted).toEqual(expected)
424430
})
@@ -433,7 +439,7 @@ describe('ignore option compatibility', () => {
433439

434440
const results = globlin.globSync(tc.pattern, options)
435441
const sorted = results.sort()
436-
const expected = tc.expected.sort()
442+
const expected = platformPaths(tc.expected).sort()
437443

438444
expect(sorted).toEqual(expected)
439445
})

0 commit comments

Comments
 (0)