77//! So we pick some random lint that will likely always be the same 
88//! over time. 
99
10- #![ allow( deprecated) ]  
11- 
1210use  super :: config:: write_config_toml; 
1311use  cargo_test_support:: registry:: Package ; 
14- use  cargo_test_support:: { basic_manifest,  project,  Project } ; 
12+ use  cargo_test_support:: { basic_manifest,  project,  str ,   Project } ; 
1513
1614// An arbitrary lint (unused_variables) that triggers a lint. 
1715// We use a special flag to force it to generate a report. 
@@ -35,8 +33,13 @@ fn output_on_stable() {
3533
3634    p. cargo ( "check" ) 
3735        . env ( "RUSTFLAGS" ,  "-Zfuture-incompat-test" ) 
38-         . with_stderr_contains ( FUTURE_OUTPUT ) 
39-         . with_stderr_contains ( "[..]cargo report[..]" ) 
36+         . with_stderr_data ( str![ [ r#" 
37+ ... 
38+ [WARNING] unused variable: `x` 
39+ ... 
40+ [NOTE] to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1` 
41+ 
42+ "# ] ] ) 
4043        . run ( ) ; 
4144} 
4245
@@ -50,7 +53,10 @@ fn no_gate_future_incompat_report() {
5053        . run ( ) ; 
5154
5255    p. cargo ( "report future-incompatibilities --id foo" ) 
53-         . with_stderr_contains ( "error: no reports are currently available" ) 
56+         . with_stderr_data ( str![ [ r#" 
57+ [ERROR] no reports are currently available 
58+ 
59+ "# ] ] ) 
5460        . with_status ( 101 ) 
5561        . run ( ) ; 
5662} 
@@ -68,25 +74,24 @@ fn test_zero_future_incompat() {
6874    // No note if --future-incompat-report is not specified. 
6975    p. cargo ( "check" ) 
7076        . env ( "RUSTFLAGS" ,  "-Zfuture-incompat-test" ) 
71-         . with_stderr ( 
72-             "\  
73-  [CHECKING] foo v0.0.0 [..]
74- [FINISHED] [..] 
75- " , 
76-         ) 
77+         . with_stderr_data ( str![ [ r#" 
78+ [CHECKING] foo v0.0.0 ([ROOT]/foo) 
79+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s 
80+ 
81+ "# ] ] ) 
7782        . run ( ) ; 
7883
7984    p. cargo ( "check --future-incompat-report" ) 
8085        . env ( "RUSTFLAGS" ,  "-Zfuture-incompat-test" ) 
81-         . with_stderr ( 
82-             "\  
83-  [FINISHED] [..]
84- note: 0 dependencies had future-incompatible warnings 
85- " , 
86-         ) 
86+         . with_stderr_data ( str![ [ r#" 
87+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s 
88+ [NOTE] 0 dependencies had future-incompatible warnings 
89+ 
90+ "# ] ] ) 
8791        . run ( ) ; 
8892} 
8993
94+ #[ allow( deprecated) ]  
9095#[ cargo_test(  
9196    nightly,  
9297    reason = "-Zfuture-incompat-test requires nightly (permanently)"  
@@ -98,8 +103,13 @@ fn test_single_crate() {
98103        let  check_has_future_compat = || { 
99104            p. cargo ( command) 
100105                . env ( "RUSTFLAGS" ,  "-Zfuture-incompat-test" ) 
101-                 . with_stderr_contains ( FUTURE_OUTPUT ) 
102-                 . with_stderr_contains ( "warning: the following packages contain code that will be rejected by a future version of Rust: foo v0.0.0 [..]" ) 
106+                 . with_stderr_data ( "\  
107+  ...
108+ [WARNING] unused variable: `x` 
109+ ... 
110+ [WARNING] the following packages contain code that will be rejected by a future version of Rust: foo v0.0.0 ([ROOT]/foo) 
111+ ... 
112+ " ) 
103113                . with_stderr_does_not_contain ( "[..]incompatibility[..]" ) 
104114                . run ( ) ; 
105115        } ; 
@@ -126,21 +136,32 @@ frequency = 'never'
126136        ) ; 
127137        p. cargo ( command) 
128138            . env ( "RUSTFLAGS" ,  "-Zfuture-incompat-test" ) 
129-             . with_stderr_contains ( FUTURE_OUTPUT ) 
139+             . with_stderr_data ( 
140+                 "\  
141+  [WARNING] unused variable: `x`
142+ ... 
143+ " , 
144+             ) 
130145            . with_stderr_does_not_contain ( "[..]rejected[..]" ) 
131146            . with_stderr_does_not_contain ( "[..]incompatibility[..]" ) 
132147            . run ( ) ; 
133148
134149        // Check that passing `--future-incompat-report` overrides `frequency = 'never'` 
135150        p. cargo ( command) . arg ( "--future-incompat-report" ) 
136151            . env ( "RUSTFLAGS" ,  "-Zfuture-incompat-test" ) 
137-             . with_stderr_contains ( FUTURE_OUTPUT ) 
138-             . with_stderr_contains ( "warning: the following packages contain code that will be rejected by a future version of Rust: foo v0.0.0 [..]" ) 
139-             . with_stderr_contains ( "  - [email protected] [..]" )  152+             . with_stderr_data ( "\  
153+  [WARNING] unused variable: `x`
154+ ... 
155+ [WARNING] the following packages contain code that will be rejected by a future version of Rust: foo v0.0.0 ([ROOT]/foo) 
156+ ... 
157+ 158+ ... 
159+ " ) 
140160            . run ( ) ; 
141161    } 
142162} 
143163
164+ #[ allow( deprecated) ]  
144165#[ cargo_test(  
145166    nightly,  
146167    reason = "-Zfuture-incompat-test requires nightly (permanently)"  
@@ -173,7 +194,11 @@ fn test_multi_crate() {
173194        p. cargo ( command) 
174195            . env ( "RUSTFLAGS" ,  "-Zfuture-incompat-test" ) 
175196            . with_stderr_does_not_contain ( FUTURE_OUTPUT ) 
176-             . with_stderr_contains ( "warning: the following packages contain code that will be rejected by a future version of Rust: first-dep v0.0.1, second-dep v0.0.2" ) 
197+             . with_stderr_data ( "\  
198+  ...
199+ [WARNING] the following packages contain code that will be rejected by a future version of Rust: first-dep v0.0.1, second-dep v0.0.2 
200+ ... 
201+ " ) 
177202            // Check that we don't have the 'triggers' message shown at the bottom of this loop, 
178203            // and that we don't explain how to show a per-package report 
179204            . with_stderr_does_not_contain ( "[..]triggers[..]" ) 
@@ -183,20 +208,42 @@ fn test_multi_crate() {
183208
184209        p. cargo ( command) . arg ( "--future-incompat-report" ) 
185210            . env ( "RUSTFLAGS" ,  "-Zfuture-incompat-test" ) 
186-             . with_stderr_contains ( "warning: the following packages contain code that will be rejected by a future version of Rust: first-dep v0.0.1, second-dep v0.0.2" ) 
187-             . with_stderr_contains ( "  - [email protected] " )  188-             . with_stderr_contains ( "  - [email protected] " )  211+             . with_stderr_data ( "\  
212+  ...
213+ [WARNING] the following packages contain code that will be rejected by a future version of Rust: first-dep v0.0.1, second-dep v0.0.2 
214+ ... 
215+ 216+ ... 
217+ 218+ ... 
219+ " ) 
189220            . run ( ) ; 
190221
191-         p
. cargo ( "report future-incompatibilities" ) . arg ( "--package" ) . arg ( "[email protected] " ) 192-             . with_stdout_contains ( "The package `first-dep v0.0.1` currently triggers the following future incompatibility lints:" ) 
193-             . with_stdout_contains ( FUTURE_OUTPUT ) 
222+         p. cargo ( "report future-incompatibilities" ) 
223+             . arg ( "--package" ) 
224+ 225+             . with_stdout_data ( 
226+                 "\  
227+  ...
228+ The package `first-dep v0.0.1` currently triggers the following future incompatibility lints: 
229+ > [WARNING] unused variable: `x` 
230+ ... 
231+ " , 
232+             ) 
194233            . with_stdout_does_not_contain ( "[..]second-dep-0.0.2/src[..]" ) 
195234            . run ( ) ; 
196235
197-         p
. cargo ( "report future-incompatibilities" ) . arg ( "--package" ) . arg ( "[email protected] " ) 198-             . with_stdout_contains ( "The package `second-dep v0.0.2` currently triggers the following future incompatibility lints:" ) 
199-             . with_stdout_contains ( FUTURE_OUTPUT ) 
236+         p. cargo ( "report future-incompatibilities" ) 
237+             . arg ( "--package" ) 
238+ 239+             . with_stdout_data ( 
240+                 "\  
241+  ...
242+ The package `second-dep v0.0.2` currently triggers the following future incompatibility lints: 
243+ > [WARNING] unused variable: `x` 
244+ ... 
245+ " , 
246+             ) 
200247            . with_stdout_does_not_contain ( "[..]first-dep-0.0.1/src[..]" ) 
201248            . run ( ) ; 
202249    } 
@@ -225,8 +272,13 @@ fn test_multi_crate() {
225272    let  id:  String  = id. chars ( ) . take_while ( |c| * c != '`' ) . collect ( ) ; 
226273
227274    p. cargo ( & format ! ( "report future-incompatibilities --id {}" ,  id) ) 
228-         . with_stdout_contains ( "The package `first-dep v0.0.1` currently triggers the following future incompatibility lints:" ) 
229-         . with_stdout_contains ( "The package `second-dep v0.0.2` currently triggers the following future incompatibility lints:" ) 
275+         . with_stdout_data ( str![ [ r#" 
276+ ... 
277+ The package `first-dep v0.0.1` currently triggers the following future incompatibility lints: 
278+ ... 
279+ The package `second-dep v0.0.2` currently triggers the following future incompatibility lints: 
280+ ... 
281+ "# ] ] ) 
230282        . run ( ) ; 
231283
232284    // Test without --id, and also the full output of the report. 
@@ -262,6 +314,7 @@ fn test_multi_crate() {
262314    assert_eq ! ( lines. next( ) ,  None ) ; 
263315} 
264316
317+ #[ allow( deprecated) ]  
265318#[ cargo_test(  
266319    nightly,  
267320    reason = "-Zfuture-incompat-test requires nightly (permanently)"  
@@ -293,7 +346,10 @@ fn bad_ids() {
293346
294347    p. cargo ( "report future-incompatibilities --id 1" ) 
295348        . with_status ( 101 ) 
296-         . with_stderr ( "error: no reports are currently available" ) 
349+         . with_stderr_data ( str![ [ r#" 
350+ [ERROR] no reports are currently available 
351+ 
352+ "# ] ] ) 
297353        . run ( ) ; 
298354
299355    p. cargo ( "check" ) 
@@ -303,17 +359,18 @@ fn bad_ids() {
303359
304360    p. cargo ( "report future-incompatibilities --id foo" ) 
305361        . with_status ( 1 ) 
306-         . with_stderr ( "error: Invalid value: could not parse `foo` as a number" ) 
362+         . with_stderr_data ( str![ 
363+             "[ERROR] Invalid value: could not parse `foo` as a number" 
364+         ] ) 
307365        . run ( ) ; 
308366
309367    p. cargo ( "report future-incompatibilities --id 7" ) 
310368        . with_status ( 101 ) 
311-         . with_stderr ( 
312-             "\  
313-  error: could not find report with ID 7
369+         . with_stderr_data ( str![ [ r#" 
370+ [ERROR] could not find report with ID 7 
314371Available IDs are: 1 
315- " , 
316-          ) 
372+ 
373+ "# ] ] ) 
317374        . run ( ) ; 
318375} 
319376
@@ -373,21 +430,29 @@ fn suggestions_for_updates() {
373430    // in a long while?). 
374431    p. cargo ( "update without_updates" ) . run ( ) ; 
375432
376-     let  update_message = "\  
433+     p. cargo ( "check --future-incompat-report" ) 
434+         . masquerade_as_nightly_cargo ( & [ "future-incompat-test" ] ) 
435+         . env ( "RUSTFLAGS" ,  "-Zfuture-incompat-test" ) 
436+         . with_stderr_data ( str![ [ r#" 
437+ ... 
377438- Some affected dependencies have newer versions available. 
378439You may want to consider updating them to a newer version to see if the issue has been fixed. 
379440
380441big_update v1.0.0 has the following newer versions available: 2.0.0 
381442with_updates v1.0.0 has the following newer versions available: 1.0.1, 1.0.2, 3.0.1 
382- " ; 
383- 
384-     p. cargo ( "check --future-incompat-report" ) 
385-         . masquerade_as_nightly_cargo ( & [ "future-incompat-test" ] ) 
386-         . env ( "RUSTFLAGS" ,  "-Zfuture-incompat-test" ) 
387-         . with_stderr_contains ( update_message) 
443+ ... 
444+ "# ] ] ) 
388445        . run ( ) ; 
389446
390447    p. cargo ( "report future-incompatibilities" ) 
391-         . with_stdout_contains ( update_message) 
448+         . with_stdout_data ( str![ [ r#" 
449+ ... 
450+ - Some affected dependencies have newer versions available. 
451+ You may want to consider updating them to a newer version to see if the issue has been fixed. 
452+ 
453+ big_update v1.0.0 has the following newer versions available: 2.0.0 
454+ with_updates v1.0.0 has the following newer versions available: 1.0.1, 1.0.2, 3.0.1 
455+ ... 
456+ "# ] ] ) 
392457        . run ( ) 
393458} 
0 commit comments