Files
swift-inotify/Tests/InotifyIntegrationTests/WatchTests.swift
T. R. Bernstein 564c409c15 Implement watching a path
Each inotify instance produces events for paths in its watch list. Each
item in the watch list is identified by its watch descriptor. Different
paths can be watched for different events.
2026-03-11 18:42:12 +01:00

22 lines
547 B
Swift

import Testing
import Foundation
@testable import Inotify
@Suite("Watch Management")
struct WatchTests {
@Test func addWatchReturnsValidDescriptor() async throws {
try await withTempDir { dir in
let watcher = try Inotify()
let wd = try await watcher.addWatch(path: dir, mask: .allEvents)
#expect(wd >= 0)
}
}
@Test func addWatchOnInvalidPathThrows() async throws {
let watcher = try Inotify()
await #expect(throws: InotifyError.self) {
try await watcher.addWatch(path: "/nonexistent-\(UUID())", mask: .allEvents)
}
}
}