From d89f2d52b623aad98df687865b263adeee7f5de9 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sun, 12 Apr 2026 21:12:26 -0500 Subject: feat: add build log search and jump-to-error navigation Implements: https://todo.sr.ht/~ccleberg/hutch/29 Implements: https://todo.sr.ht/~ccleberg/hutch/30 --- HutchTests/BuildTaskLogSearchTests.swift | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 HutchTests/BuildTaskLogSearchTests.swift (limited to 'HutchTests/BuildTaskLogSearchTests.swift') diff --git a/HutchTests/BuildTaskLogSearchTests.swift b/HutchTests/BuildTaskLogSearchTests.swift new file mode 100644 index 0000000..4cb9984 --- /dev/null +++ b/HutchTests/BuildTaskLogSearchTests.swift @@ -0,0 +1,30 @@ +import Testing +@testable import Hutch + +struct BuildTaskLogSearchTests { + + @Test + func logMatchRangesFindsCaseInsensitiveOccurrences() { + let matches = logMatchRanges(in: "Error: one\nerror: two\nwarning", query: "ERROR") + + #expect(matches.count == 2) + #expect(matches[0] == LogTextRange(location: 0, length: 5)) + #expect(matches[1].location > matches[0].location) + } + + @Test + func detectLogAnchorsFindsImportantFailureLines() { + let anchors = detectLogAnchors(in: """ + compile step + warning: this is fine + error: missing header + traceback (most recent call last): + panic: build failed + """) + + #expect(anchors.count == 2) + #expect(anchors[0].lineNumber == 3) + #expect(anchors[0].label.contains("missing header")) + #expect(anchors[1].lineNumber == 5) + } +} -- cgit v1.2.3