restores Helder in all its glory
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import HelderUI
|
||||
import Testing
|
||||
|
||||
@MainActor
|
||||
private final class RecordingTerminal: TerminalSessionHandle {
|
||||
var sent: [String] = []
|
||||
func send(_ text: String) { sent.append(text) }
|
||||
func terminate() {}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@Suite struct TerminalStoreTests {
|
||||
@Test func insertIntoAgentIsABracketedPasteOnItsOwnLine() {
|
||||
let store = TerminalStore(projectRoot: "/p")
|
||||
let agent = RecordingTerminal()
|
||||
store.attach(agent, as: .agent)
|
||||
store.insertIntoAgent(text: "a.php:1")
|
||||
store.insertIntoAgent(text: "b.php:2-3")
|
||||
#expect(agent.sent == ["\u{1b}[200~a.php:1\u{1b}[201~", "\u{1b}[200~\nb.php:2-3\u{1b}[201~"])
|
||||
}
|
||||
|
||||
@Test func enterEmptiesTheComposer() {
|
||||
let store = TerminalStore()
|
||||
let agent = RecordingTerminal()
|
||||
store.attach(agent, as: .agent)
|
||||
store.agentReceivedInput("x")
|
||||
#expect(store.agentComposerHasText)
|
||||
store.agentReceivedInput("\r")
|
||||
store.insertIntoAgent(text: "ref")
|
||||
#expect(agent.sent == ["\u{1b}[200~ref\u{1b}[201~"])
|
||||
}
|
||||
|
||||
@Test func withoutAnAgentNothingIsSent() {
|
||||
let store = TerminalStore()
|
||||
store.insertIntoAgent(text: "ref")
|
||||
#expect(!store.agentComposerHasText)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user