Describe the errno an error stores, not the current one
The description looked up the message of whatever errno was set when the description was built, so an error printed later read "Success (errno 28)".
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import Testing
|
||||
@testable import Inotify
|
||||
|
||||
@Suite("Error Description")
|
||||
struct InotifyErrorTests {
|
||||
@Test func describesTheStoredErrnoAndNotTheCurrentOne() {
|
||||
let error = InotifyError.addWatchFailed(path: "/watched", errno: 28)
|
||||
|
||||
#expect(error.description == "inotify_add_watch failed for '/watched': No space left on device (errno 28)")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user