Files
swift-inotify/Tests/InotifyIntegrationTests/ExclusionTests.swift
T
T. R. Bernstein 8af25be549
Docs / docs (push) Canceled after 0s
Docs / deploy (push) Canceled after 0s
Exclude items by shell pattern as well as by name
Patterns such as `.*` or `@*` are matched against an item's own name
with `fnmatch`, in the same places as excluded names: resolving a
tree, extending a watch to a directory that appears later, and
delivering events. Dependents that prune large trees can now skip
whole families of directories without listing each name.
2026-09-16 11:21:45 +02:00

23 lines
592 B
Swift

import Testing
@testable import Inotify
@Suite("Exclusion")
struct ExclusionTests {
@Test func excludesANameThatMatchesAPattern() async throws {
let inotify = try Inotify()
await inotify.exclude(patterns: "*.tmp", "@*")
#expect(await inotify.isExcluded("scan.tmp"))
#expect(await inotify.isExcluded("@eaDir"))
#expect(await !inotify.isExcluded("scan.pdf"))
}
@Test func excludesAnExactName() async throws {
let inotify = try Inotify()
await inotify.exclude(name: ".git")
#expect(await inotify.isExcluded(".git"))
#expect(await !inotify.isExcluded(".gitignore"))
}
}