v1.4.0 release: live-coding scratch editor, interpreted Graph DSL, ClosureSynthesizer + SampleLoop
This commit is contained in:
@@ -664,4 +664,22 @@ struct DiskInOutTests {
|
||||
diskOut.close() // second call must not crash or deadlock
|
||||
#expect(FileManager.default.fileExists(atPath: outURL.path))
|
||||
}
|
||||
|
||||
/// A `DiskOut.Audio` whose output path is unwritable must throw from `init`
|
||||
/// rather than construct a half-built recorder. This throw happens before
|
||||
/// `super.init()`, so the ring storage is freed by an explicit
|
||||
/// `deallocate()` on the throw path (Swift does not run `deinit` for an
|
||||
/// initializer that throws before `super.init()`).
|
||||
@Test func diskOutInvalidURLThrows() {
|
||||
// A path under a directory that does not exist — ExtAudioFileCreateWithURL fails.
|
||||
let badURL: URL = URL(fileURLWithPath: "/nonexistent-dir-\(UUID().uuidString)/out.wav")
|
||||
#expect(throws: DiskOutError.self) {
|
||||
_ = try DiskOut.Audio(source: 0.0 as Double,
|
||||
channelCount: 2,
|
||||
url: badURL,
|
||||
sampleRate: 44100,
|
||||
format: .wav,
|
||||
bufferFrames: 8192)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user