@@ -19,55 +19,52 @@ import Testing
1919
2020class TestCLIProgressAuto : CLITest {
2121 @Test func testAutoProgressFallsBackToPlainWhenPiped( ) throws {
22- do {
23- let ( _, _, error, status) = try run ( arguments: [
24- " image " , " pull " ,
25- " --progress " , " auto " ,
26- alpine,
27- ] )
28- #expect( status == 0 , " image pull should succeed, stderr: \( error) " )
29- let lines = error. components ( separatedBy: . newlines)
30- . filter { !$0. contains ( " Warning! Running debug build " ) && !$0. isEmpty }
31- #expect( !lines. isEmpty, " expected plain progress output on stderr when piped " )
32- #expect( !error. contains ( " \u{1B} [ " ) , " expected no ANSI escapes in piped output " )
33- } catch {
34- Issue . record ( " failed to test auto progress: \( error) " )
35- return
36- }
22+ let ( _, _, error, status) = try run ( arguments: [
23+ " image " , " pull " ,
24+ " --progress " , " auto " ,
25+ alpine,
26+ ] )
27+ #expect( status == 0 , " image pull should succeed, stderr: \( error) " )
28+ let lines = error. components ( separatedBy: . newlines)
29+ . filter { !$0. contains ( " Warning! Running debug build " ) && !$0. isEmpty }
30+ #expect( !lines. isEmpty, " expected plain progress output on stderr when piped " )
31+ #expect( !error. contains ( " \u{1B} [ " ) , " expected no ANSI escapes in piped output " )
3732 }
3833
3934 @Test func testExplicitPlainProgress( ) throws {
40- do {
41- let ( _, _, error, status) = try run ( arguments: [
42- " image " , " pull " ,
43- " --progress " , " plain " ,
44- alpine,
45- ] )
46- #expect( status == 0 , " image pull --progress plain should succeed, stderr: \( error) " )
47- let lines = error. components ( separatedBy: . newlines)
48- . filter { !$0. contains ( " Warning! Running debug build " ) && !$0. isEmpty }
49- #expect( !lines. isEmpty, " expected plain progress output on stderr " )
50- #expect( !error. contains ( " \u{1B} [ " ) , " expected no ANSI escapes with --progress plain " )
51- } catch {
52- Issue . record ( " failed to test plain progress: \( error) " )
53- return
54- }
35+ let ( _, _, error, status) = try run ( arguments: [
36+ " image " , " pull " ,
37+ " --progress " , " plain " ,
38+ alpine,
39+ ] )
40+ #expect( status == 0 , " image pull --progress plain should succeed, stderr: \( error) " )
41+ let lines = error. components ( separatedBy: . newlines)
42+ . filter { !$0. contains ( " Warning! Running debug build " ) && !$0. isEmpty }
43+ #expect( !lines. isEmpty, " expected plain progress output on stderr " )
44+ #expect( !error. contains ( " \u{1B} [ " ) , " expected no ANSI escapes with --progress plain " )
45+ }
46+
47+ @Test func testExplicitAnsiProgress( ) throws {
48+ let ( _, _, error, status) = try run ( arguments: [
49+ " image " , " pull " ,
50+ " --progress " , " ansi " ,
51+ alpine,
52+ ] )
53+ #expect( status == 0 , " image pull --progress ansi should succeed, stderr: \( error) " )
54+ let lines = error. components ( separatedBy: . newlines)
55+ . filter { !$0. contains ( " Warning! Running debug build " ) && !$0. isEmpty }
56+ #expect( !lines. isEmpty, " expected ansi progress output on stderr " )
5557 }
5658
5759 @Test func testNoneProgressSuppressesOutput( ) throws {
58- do {
59- let ( _, _, error, status) = try run ( arguments: [
60- " image " , " pull " ,
61- " --progress " , " none " ,
62- alpine,
63- ] )
64- #expect( status == 0 , " image pull --progress none should succeed, stderr: \( error) " )
65- let lines = error. components ( separatedBy: . newlines)
66- . filter { !$0. contains ( " Warning! Running debug build " ) && !$0. isEmpty }
67- #expect( lines. isEmpty, " expected no progress output on stderr with --progress none " )
68- } catch {
69- Issue . record ( " failed to test none progress: \( error) " )
70- return
71- }
60+ let ( _, _, error, status) = try run ( arguments: [
61+ " image " , " pull " ,
62+ " --progress " , " none " ,
63+ alpine,
64+ ] )
65+ #expect( status == 0 , " image pull --progress none should succeed, stderr: \( error) " )
66+ let lines = error. components ( separatedBy: . newlines)
67+ . filter { !$0. contains ( " Warning! Running debug build " ) && !$0. isEmpty }
68+ #expect( lines. isEmpty, " expected no progress output on stderr with --progress none " )
7269 }
7370}
0 commit comments