1
1
//! Tests for progress bar.
2
2
3
- #![ allow( deprecated) ]
4
-
3
+ use cargo_test_support:: prelude:: * ;
5
4
use cargo_test_support:: project;
6
5
use cargo_test_support:: registry:: Package ;
6
+ use cargo_test_support:: str;
7
7
8
8
#[ cargo_test]
9
9
fn bad_progress_config_unknown_when ( ) {
@@ -20,15 +20,13 @@ fn bad_progress_config_unknown_when() {
20
20
21
21
p. cargo ( "check" )
22
22
. with_status ( 101 )
23
- . with_stderr (
24
- "\
25
- [ERROR] error in [..].cargo/config.toml: \
26
- could not load config key `term.progress.when`
23
+ . with_stderr_data ( str![ [ r#"
24
+ [ERROR] error in [ROOT]/foo/.cargo/config.toml: could not load config key `term.progress.when`
27
25
28
26
Caused by:
29
27
unknown variant `unknown`, expected one of `auto`, `never`, `always`
30
- " ,
31
- )
28
+
29
+ "# ] ] )
32
30
. run ( ) ;
33
31
}
34
32
@@ -47,11 +45,10 @@ fn bad_progress_config_missing_width() {
47
45
48
46
p. cargo ( "check" )
49
47
. with_status ( 101 )
50
- . with_stderr (
51
- "\
52
- [ERROR] \" always\" progress requires a `width` key
53
- " ,
54
- )
48
+ . with_stderr_data ( str![ [ r#"
49
+ [ERROR] "always" progress requires a `width` key
50
+
51
+ "# ] ] )
55
52
. run ( ) ;
56
53
}
57
54
@@ -70,14 +67,13 @@ fn bad_progress_config_missing_when() {
70
67
71
68
p. cargo ( "check" )
72
69
. with_status ( 101 )
73
- . with_stderr (
74
- "\
75
- error: error in [..]: could not load config key `term.progress`
70
+ . with_stderr_data ( str![ [ r#"
71
+ [ERROR] error in [ROOT]/foo/.cargo/config.toml: could not load config key `term.progress`
76
72
77
73
Caused by:
78
74
missing field `when`
79
- " ,
80
- )
75
+
76
+ "# ] ] )
81
77
. run ( ) ;
82
78
}
83
79
@@ -116,12 +112,23 @@ fn always_shows_progress() {
116
112
. build ( ) ;
117
113
118
114
p. cargo ( "check" )
119
- . with_stderr_contains ( "[DOWNLOADING] [..] crates [..]" )
120
- . with_stderr_contains ( "[..][DOWNLOADED] 3 crates ([..]) in [..]" )
121
- . with_stderr_contains ( "[BUILDING] [..] [..]/4: [..]" )
115
+ . with_stderr_data (
116
+ str![ [ r#"
117
+ [DOWNLOADING] 1 crate
118
+ [DOWNLOADING] 2 crates
119
+ [DOWNLOADING] 3 crates
120
+ [DOWNLOADED] 3 crates ([..]KB) in [..]s
121
+ [BUILDING] [..] 0/4: [..]
122
+ [BUILDING] [..] 3/4: foo
123
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
124
+ ...
125
+ "# ] ]
126
+ . unordered ( ) ,
127
+ )
122
128
. run ( ) ;
123
129
}
124
130
131
+ #[ allow( deprecated) ]
125
132
#[ cargo_test]
126
133
fn never_progress ( ) {
127
134
const N : usize = 3 ;
0 commit comments