File tree 3 files changed +3161
-1
lines changed
Tests/XcbeautifyLibTests/ParsingTests
3 files changed +3161
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,10 @@ let package = Package(
38
38
) ,
39
39
. testTarget(
40
40
name: " XcbeautifyLibTests " ,
41
- dependencies: [ " XcbeautifyLib " ]
41
+ dependencies: [ " XcbeautifyLib " ] ,
42
+ resources: [
43
+ . copy( " ParsingTests/clean_build_xcode_15_1.txt " ) ,
44
+ ]
42
45
) ,
43
46
]
44
47
)
Original file line number Diff line number Diff line change
1
+ import XCTest
2
+ @testable import XcbeautifyLib
3
+
4
+ final class ParsingTests : XCTestCase {
5
+ func testCleanBuildXcode15_1( ) throws {
6
+ let url = Bundle . module. url ( forResource: " clean_build_xcode_15_1 " , withExtension: " txt " ) !
7
+
8
+ var buildLog : [ String ] = try String ( contentsOf: url)
9
+ . components ( separatedBy: . newlines)
10
+
11
+ let parser = Parser (
12
+ colored: false ,
13
+ renderer: . terminal,
14
+ preserveUnbeautifiedLines: false ,
15
+ additionalLines: {
16
+ guard !buildLog. isEmpty else {
17
+ XCTFail ( " The build log should never be empty when fetching additional lines. " )
18
+ return nil
19
+ }
20
+ return buildLog. removeFirst ( )
21
+ }
22
+ )
23
+
24
+ var uncapturedOutput = 0
25
+
26
+ while !buildLog. isEmpty {
27
+ let line = buildLog. removeFirst ( )
28
+ if !line. isEmpty, parser. parse ( line: line) == nil {
29
+ uncapturedOutput += 1
30
+ }
31
+ }
32
+
33
+ // The following is a magic number.
34
+ // It represents the number of lines that aren't captured by the Parser.
35
+ // Slowly, this value should decrease until it reaches 0.
36
+ // It uses `XCTAssertEqual` instead of `XCTAssertLessThanOrEqual` as a reminder.
37
+ // Update this magic number whenever `uncapturedOutput` is less than the current magic number.
38
+ // There's a regression whenever `uncapturedOutput` is greater than the current magic number.
39
+ XCTAssertEqual ( uncapturedOutput, 2218 )
40
+ }
41
+ }
You can’t perform that action at this time.
0 commit comments