mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-26 23:28:43 +00:00
11 lines
550 B
TypeScript
11 lines
550 B
TypeScript
import { expect, test } from "bun:test"
|
|
import { Glob } from "../src/glob.js"
|
|
|
|
test("a compiled matcher agrees with match", () => {
|
|
const paths = ["a.ts", "src/b.ts", ".hidden/c.ts", "src/.d.ts", "e.js", "#notes", "src/nested/f.tsx"]
|
|
for (const pattern of ["**/*.ts", "*.{ts,js}", "src/**", ".*/*", "#notes", "**/*.ts?(x)", "!(*.ts)"])
|
|
for (const dot of [undefined, true, false]) {
|
|
const matches = Glob.matcher(pattern, { dot })
|
|
expect(paths.map(matches)).toEqual(paths.map((path) => Glob.match(pattern, path, { dot })))
|
|
}
|
|
})
|