summaryrefslogtreecommitdiff
path: root/HutchTests
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-12 21:12:26 -0500
committerChristian Cleberg <[email protected]>2026-04-12 21:12:26 -0500
commitd89f2d52b623aad98df687865b263adeee7f5de9 (patch)
tree0fa61b80a7c5553f43b65fd5326879b8e94b9462 /HutchTests
parent9cd99c3e1c7e2620c34bfd9e78931e3b2b63aa8a (diff)
downloadhutch-d89f2d52b623aad98df687865b263adeee7f5de9.tar.gz
hutch-d89f2d52b623aad98df687865b263adeee7f5de9.tar.bz2
hutch-d89f2d52b623aad98df687865b263adeee7f5de9.zip
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
Diffstat (limited to 'HutchTests')
-rw-r--r--HutchTests/BuildTaskLogSearchTests.swift30
1 files changed, 30 insertions, 0 deletions
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)
+ }
+}