8519cabe42
Additive conveniences to the macOS-only Live Scratch editor. No changes to existing public API. - Run Selection (⌘E): evaluate just the highlighted text, additively. - Graceful slot release: context.release(slot:) / free(slot:). - Engine panel: live oscilloscope (ScopeCapture) + CPU avg/peak + counts. - Reset Session / Restart to Reclaim Memory. - Always-open console panel (report messages + errors with line:col). - Faster typing: debounced highlight, updateNSView fast-path, publish guards. - Manual code completion (Esc / F5), no auto-trigger on `.`; completion replaces the partial word, not the receiver expression. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
44 lines
1.2 KiB
Swift
44 lines
1.2 KiB
Swift
// MessageLogTests.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#if os(macOS)
|
|
import Testing
|
|
import LyrebirdSynth
|
|
@testable import LyrebirdLiveCompile
|
|
|
|
@MainActor
|
|
@Suite("LiveSession message log")
|
|
struct MessageLogTests {
|
|
|
|
private func makeSession() -> LiveSession {
|
|
let engine: SynthesisEngine = SynthesisEngine(
|
|
blockSize: 64,
|
|
controlBlockSize: 16,
|
|
sampleRate: 48_000,
|
|
numOutputChannels: 2,
|
|
numInputChannels: 0,
|
|
numAudioBuses: 16,
|
|
numControlBuses: 16,
|
|
eventQueueCapacity: lyrebirdDefaultEventQueueCapacity,
|
|
driver: OfflineDriver()
|
|
)
|
|
return LiveSession(engine: engine)
|
|
}
|
|
|
|
@Test func accumulatesAndDrains() {
|
|
let session: LiveSession = makeSession()
|
|
session.appendMessage("a")
|
|
session.appendMessage("b")
|
|
#expect(session.lastSnippetMessage == "b") // last value, for tests
|
|
#expect(session.drainMessages() == ["a", "b"])
|
|
// Drained → empty.
|
|
#expect(session.lastSnippetMessage == nil)
|
|
#expect(session.drainMessages().isEmpty)
|
|
}
|
|
}
|
|
|
|
#endif
|