@@ -115,6 +115,44 @@ final class SwiftToolTests: CommandsTestCase {
115
115
XCTAssertMatch ( outputStream. bytes. validDescription, . contains( " info: info " ) )
116
116
XCTAssertMatch ( outputStream. bytes. validDescription, . contains( " debug: debug " ) )
117
117
}
118
+
119
+ do {
120
+ let outputStream = BufferedOutputByteStream ( )
121
+ let options = try GlobalOptions . parse ( [ " --package-path " , fixturePath. pathString, " --quiet " ] )
122
+ let tool = try SwiftTool . createSwiftToolForTest ( outputStream: outputStream, options: options)
123
+ XCTAssertEqual ( tool. logLevel, . error)
124
+
125
+ tool. observabilityScope. emit ( error: " error " )
126
+ tool. observabilityScope. emit ( warning: " warning " )
127
+ tool. observabilityScope. emit ( info: " info " )
128
+ tool. observabilityScope. emit ( debug: " debug " )
129
+
130
+ tool. waitForObservabilityEvents ( timeout: . now( ) + . seconds( 1 ) )
131
+
132
+ XCTAssertMatch ( outputStream. bytes. validDescription, . contains( " error: error " ) )
133
+ XCTAssertNoMatch ( outputStream. bytes. validDescription, . contains( " warning: warning " ) )
134
+ XCTAssertNoMatch ( outputStream. bytes. validDescription, . contains( " info: info " ) )
135
+ XCTAssertNoMatch ( outputStream. bytes. validDescription, . contains( " debug: debug " ) )
136
+ }
137
+
138
+ do {
139
+ let outputStream = BufferedOutputByteStream ( )
140
+ let options = try GlobalOptions . parse ( [ " --package-path " , fixturePath. pathString, " -q " ] )
141
+ let tool = try SwiftTool . createSwiftToolForTest ( outputStream: outputStream, options: options)
142
+ XCTAssertEqual ( tool. logLevel, . error)
143
+
144
+ tool. observabilityScope. emit ( error: " error " )
145
+ tool. observabilityScope. emit ( warning: " warning " )
146
+ tool. observabilityScope. emit ( info: " info " )
147
+ tool. observabilityScope. emit ( debug: " debug " )
148
+
149
+ tool. waitForObservabilityEvents ( timeout: . now( ) + . seconds( 1 ) )
150
+
151
+ XCTAssertMatch ( outputStream. bytes. validDescription, . contains( " error: error " ) )
152
+ XCTAssertNoMatch ( outputStream. bytes. validDescription, . contains( " warning: warning " ) )
153
+ XCTAssertNoMatch ( outputStream. bytes. validDescription, . contains( " info: info " ) )
154
+ XCTAssertNoMatch ( outputStream. bytes. validDescription, . contains( " debug: debug " ) )
155
+ }
118
156
}
119
157
}
120
158
0 commit comments