krz/hutch
an ios client for sourcehut
clone: git clone https://gitbay.org/krz/hutch.git
v3.1.5: HutchTests/BuildTaskLogSearchTests.swift · raw
1import Testing
2@testable import Hutch
3
4struct BuildTaskLogSearchTests {
5
6 @Test
7 func logMatchRangesFindsCaseInsensitiveOccurrences() {
8 let matches = logMatchRanges(in: "Error: one\nerror: two\nwarning", query: "ERROR")
9
10 #expect(matches.count == 2)
11 #expect(matches[0] == LogTextRange(location: 0, length: 5))
12 #expect(matches[1].location > matches[0].location)
13 }
14
15 @Test
16 func detectLogAnchorsFindsImportantFailureLines() {
17 let anchors = detectLogAnchors(in: """
18 compile step
19 warning: this is fine
20 error: missing header
21 traceback (most recent call last):
22 panic: build failed
23 """)
24
25 #expect(anchors.count == 2)
26 #expect(anchors[0].lineNumber == 3)
27 #expect(anchors[0].label.contains("missing header"))
28 #expect(anchors[1].lineNumber == 5)
29 }
30}