22
33use cargo_test_support:: { basic_manifest, is_nightly, project} ;
44
5- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
5+ macro_rules! x {
6+ ( $tool: tt => $what: tt $( of $who: tt) ?) => { {
7+ #[ cfg( windows) ]
8+ {
9+ concat!( "[RUNNING] [..]" , $tool, "[..] --check-cfg " ,
10+ $what, '(' , $( $who, ) * ')' , "[..]" )
11+ }
12+ #[ cfg( not( windows) ) ]
13+ {
14+ concat!( "[RUNNING] [..]" , $tool, "[..] --check-cfg '" ,
15+ $what, '(' , $( $who, ) * ')' , "'" , "[..]" )
16+ }
17+ } } ;
18+ ( $tool: tt => $what: tt of $who: tt with $( $values: tt) * ) => { {
19+ #[ cfg( windows) ]
20+ {
21+ concat!( "[RUNNING] [..]" , $tool, "[..] --check-cfg \" " ,
22+ $what, '(' , $who, $( ", " , "/\" " , $values, "/\" " , ) * ")" , '"' , "[..]" )
23+ }
24+ #[ cfg( not( windows) ) ]
25+ {
26+ concat!( "[RUNNING] [..]" , $tool, "[..] --check-cfg '" ,
27+ $what, '(' , $who, $( ", " , "\" " , $values, "\" " , ) * ")" , "'" , "[..]" )
28+ }
29+ } } ;
30+ }
31+
632#[ cargo_test]
733fn features ( ) {
834 if !is_nightly ( ) {
@@ -28,17 +54,10 @@ fn features() {
2854
2955 p. cargo ( "build -v -Zcheck-cfg=features" )
3056 . masquerade_as_nightly_cargo ( )
31- . with_stderr (
32- "\
33- [COMPILING] foo v0.1.0 [..]
34- [RUNNING] `rustc [..] --check-cfg 'values(feature, \" f_a\" , \" f_b\" )' [..]
35- [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
36- " ,
37- )
57+ . with_stderr_contains ( x ! ( "rustc" => "values" of "feature" with "f_a" "f_b" ) )
3858 . run ( ) ;
3959}
4060
41- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
4261#[ cargo_test]
4362fn features_with_deps ( ) {
4463 if !is_nightly ( ) {
@@ -69,19 +88,11 @@ fn features_with_deps() {
6988
7089 p. cargo ( "build -v -Zcheck-cfg=features" )
7190 . masquerade_as_nightly_cargo ( )
72- . with_stderr (
73- "\
74- [COMPILING] bar v0.1.0 [..]
75- [RUNNING] `rustc [..] --check-cfg 'values(feature)' [..]
76- [COMPILING] foo v0.1.0 [..]
77- [RUNNING] `rustc --crate-name foo [..] --check-cfg 'values(feature, \" f_a\" , \" f_b\" )' [..]
78- [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
79- " ,
80- )
91+ . with_stderr_contains ( x ! ( "rustc" => "values" of "feature" ) )
92+ . with_stderr_contains ( x ! ( "rustc" => "values" of "feature" with "f_a" "f_b" ) )
8193 . run ( ) ;
8294}
8395
84- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
8596#[ cargo_test]
8697fn features_with_opt_deps ( ) {
8798 if !is_nightly ( ) {
@@ -113,19 +124,11 @@ fn features_with_opt_deps() {
113124
114125 p. cargo ( "build -v -Zcheck-cfg=features" )
115126 . masquerade_as_nightly_cargo ( )
116- . with_stderr (
117- "\
118- [COMPILING] bar v0.1.0 [..]
119- [RUNNING] `rustc [..] --check-cfg 'values(feature)' [..]
120- [COMPILING] foo v0.1.0 [..]
121- [RUNNING] `rustc --crate-name foo [..] --check-cfg 'values(feature, \" bar\" , \" default\" , \" f_a\" , \" f_b\" )' [..]
122- [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
123- " ,
124- )
127+ . with_stderr_contains ( x ! ( "rustc" => "values" of "feature" ) )
128+ . with_stderr_contains ( x ! ( "rustc" => "values" of "feature" with "bar" "default" "f_a" "f_b" ) )
125129 . run ( ) ;
126130}
127131
128- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
129132#[ cargo_test]
130133fn features_with_namespaced_features ( ) {
131134 if !is_nightly ( ) {
@@ -156,17 +159,10 @@ fn features_with_namespaced_features() {
156159
157160 p. cargo ( "build -v -Zcheck-cfg=features" )
158161 . masquerade_as_nightly_cargo ( )
159- . with_stderr (
160- "\
161- [COMPILING] foo v0.1.0 [..]
162- [RUNNING] `rustc --crate-name foo [..] --check-cfg 'values(feature, \" f_a\" , \" f_b\" )' [..]
163- [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
164- " ,
165- )
162+ . with_stderr_contains ( x ! ( "rustc" => "values" of "feature" with "f_a" "f_b" ) )
166163 . run ( ) ;
167164}
168165
169- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
170166#[ cargo_test]
171167fn well_known_names ( ) {
172168 if !is_nightly ( ) {
@@ -181,17 +177,10 @@ fn well_known_names() {
181177
182178 p. cargo ( "build -v -Zcheck-cfg=names" )
183179 . masquerade_as_nightly_cargo ( )
184- . with_stderr (
185- "\
186- [COMPILING] foo v0.1.0 [..]
187- [RUNNING] `rustc [..] --check-cfg 'names()' [..]
188- [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
189- " ,
190- )
180+ . with_stderr_contains ( x ! ( "rustc" => "names" ) )
191181 . run ( ) ;
192182}
193183
194- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
195184#[ cargo_test]
196185fn well_known_values ( ) {
197186 if !is_nightly ( ) {
@@ -206,17 +195,10 @@ fn well_known_values() {
206195
207196 p. cargo ( "build -v -Zcheck-cfg=values" )
208197 . masquerade_as_nightly_cargo ( )
209- . with_stderr (
210- "\
211- [COMPILING] foo v0.1.0 [..]
212- [RUNNING] `rustc [..] --check-cfg 'values()' [..]
213- [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
214- " ,
215- )
198+ . with_stderr_contains ( x ! ( "rustc" => "values" ) )
216199 . run ( ) ;
217200}
218201
219- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
220202#[ cargo_test]
221203fn cli_all_options ( ) {
222204 if !is_nightly ( ) {
@@ -242,10 +224,12 @@ fn cli_all_options() {
242224
243225 p. cargo ( "build -v -Zcheck-cfg=features,names,values" )
244226 . masquerade_as_nightly_cargo ( )
227+ . with_stderr_contains ( x ! ( "rustc" => "names" ) )
228+ . with_stderr_contains ( x ! ( "rustc" => "values" ) )
229+ . with_stderr_contains ( x ! ( "rustc" => "values" of "feature" with "f_a" "f_b" ) )
245230 . run ( ) ;
246231}
247232
248- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
249233#[ cargo_test]
250234fn features_with_cargo_check ( ) {
251235 if !is_nightly ( ) {
@@ -271,17 +255,10 @@ fn features_with_cargo_check() {
271255
272256 p. cargo ( "check -v -Zcheck-cfg=features" )
273257 . masquerade_as_nightly_cargo ( )
274- . with_stderr (
275- "\
276- [CHECKING] foo v0.1.0 [..]
277- [RUNNING] `rustc [..] --check-cfg 'values(feature, \" f_a\" , \" f_b\" )' [..]
278- [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
279- " ,
280- )
258+ . with_stderr_contains ( x ! ( "rustc" => "values" of "feature" with "f_a" "f_b" ) )
281259 . run ( ) ;
282260}
283261
284- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
285262#[ cargo_test]
286263fn well_known_names_with_check ( ) {
287264 if !is_nightly ( ) {
@@ -296,17 +273,10 @@ fn well_known_names_with_check() {
296273
297274 p. cargo ( "check -v -Zcheck-cfg=names" )
298275 . masquerade_as_nightly_cargo ( )
299- . with_stderr (
300- "\
301- [CHECKING] foo v0.1.0 [..]
302- [RUNNING] `rustc [..] --check-cfg 'names()' [..]
303- [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
304- " ,
305- )
276+ . with_stderr_contains ( x ! ( "rustc" => "names" ) )
306277 . run ( ) ;
307278}
308279
309- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
310280#[ cargo_test]
311281fn well_known_values_with_check ( ) {
312282 if !is_nightly ( ) {
@@ -321,17 +291,10 @@ fn well_known_values_with_check() {
321291
322292 p. cargo ( "check -v -Zcheck-cfg=values" )
323293 . masquerade_as_nightly_cargo ( )
324- . with_stderr (
325- "\
326- [CHECKING] foo v0.1.0 [..]
327- [RUNNING] `rustc [..] --check-cfg 'values()' [..]
328- [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
329- " ,
330- )
294+ . with_stderr_contains ( x ! ( "rustc" => "values" ) )
331295 . run ( ) ;
332296}
333297
334- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
335298#[ cargo_test]
336299fn features_test ( ) {
337300 if !is_nightly ( ) {
@@ -357,18 +320,10 @@ fn features_test() {
357320
358321 p. cargo ( "test -v -Zcheck-cfg=features" )
359322 . masquerade_as_nightly_cargo ( )
360- . with_stderr (
361- "\
362- [COMPILING] foo v0.1.0 [..]
363- [RUNNING] `rustc [..] --check-cfg 'values(feature, \" f_a\" , \" f_b\" )' [..]
364- [FINISHED] test [unoptimized + debuginfo] target(s) in [..]
365- [RUNNING] [..]
366- " ,
367- )
323+ . with_stderr_contains ( x ! ( "rustc" => "values" of "feature" with "f_a" "f_b" ) )
368324 . run ( ) ;
369325}
370326
371- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
372327#[ cargo_test]
373328fn features_doctest ( ) {
374329 if !is_nightly ( ) {
@@ -395,19 +350,11 @@ fn features_doctest() {
395350
396351 p. cargo ( "test -v --doc -Zcheck-cfg=features" )
397352 . masquerade_as_nightly_cargo ( )
398- . with_stderr (
399- "\
400- [COMPILING] foo v0.1.0 [..]
401- [RUNNING] `rustc [..] --check-cfg 'values(feature, \" default\" , \" f_a\" , \" f_b\" )' [..]
402- [FINISHED] test [unoptimized + debuginfo] target(s) in [..]
403- [DOCTEST] foo
404- [RUNNING] `rustdoc [..] --check-cfg 'values(feature, \" default\" , \" f_a\" , \" f_b\" )' [..]
405- " ,
406- )
353+ . with_stderr_contains ( x ! ( "rustc" => "values" of "feature" with "default" "f_a" "f_b" ) )
354+ . with_stderr_contains ( x ! ( "rustdoc" => "values" of "feature" with "default" "f_a" "f_b" ) )
407355 . run ( ) ;
408356}
409357
410- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
411358#[ cargo_test]
412359fn well_known_names_test ( ) {
413360 if !is_nightly ( ) {
@@ -422,18 +369,10 @@ fn well_known_names_test() {
422369
423370 p. cargo ( "test -v -Zcheck-cfg=names" )
424371 . masquerade_as_nightly_cargo ( )
425- . with_stderr (
426- "\
427- [COMPILING] foo v0.1.0 [..]
428- [RUNNING] `rustc [..] --check-cfg 'names()' [..]
429- [FINISHED] test [unoptimized + debuginfo] target(s) in [..]
430- [RUNNING] [..]
431- " ,
432- )
372+ . with_stderr_contains ( x ! ( "rustc" => "names" ) )
433373 . run ( ) ;
434374}
435375
436- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
437376#[ cargo_test]
438377fn well_known_values_test ( ) {
439378 if !is_nightly ( ) {
@@ -448,18 +387,10 @@ fn well_known_values_test() {
448387
449388 p. cargo ( "test -v -Zcheck-cfg=values" )
450389 . masquerade_as_nightly_cargo ( )
451- . with_stderr (
452- "\
453- [COMPILING] foo v0.1.0 [..]
454- [RUNNING] `rustc [..] --check-cfg 'values()' [..]
455- [FINISHED] test [unoptimized + debuginfo] target(s) in [..]
456- [RUNNING] [..]
457- " ,
458- )
390+ . with_stderr_contains ( x ! ( "rustc" => "values" ) )
459391 . run ( ) ;
460392}
461393
462- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
463394#[ cargo_test]
464395fn well_known_names_doctest ( ) {
465396 if !is_nightly ( ) {
@@ -474,19 +405,11 @@ fn well_known_names_doctest() {
474405
475406 p. cargo ( "test -v --doc -Zcheck-cfg=names" )
476407 . masquerade_as_nightly_cargo ( )
477- . with_stderr (
478- "\
479- [COMPILING] foo v0.1.0 [..]
480- [RUNNING] `rustc [..] --check-cfg 'names()' [..]
481- [FINISHED] test [unoptimized + debuginfo] target(s) in [..]
482- [DOCTEST] foo
483- [RUNNING] `rustdoc [..] --check-cfg 'names()' [..]
484- " ,
485- )
408+ . with_stderr_contains ( x ! ( "rustc" => "names" ) )
409+ . with_stderr_contains ( x ! ( "rustdoc" => "names" ) )
486410 . run ( ) ;
487411}
488412
489- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
490413#[ cargo_test]
491414fn well_known_values_doctest ( ) {
492415 if !is_nightly ( ) {
@@ -501,19 +424,11 @@ fn well_known_values_doctest() {
501424
502425 p. cargo ( "test -v --doc -Zcheck-cfg=values" )
503426 . masquerade_as_nightly_cargo ( )
504- . with_stderr (
505- "\
506- [COMPILING] foo v0.1.0 [..]
507- [RUNNING] `rustc [..] --check-cfg 'values()' [..]
508- [FINISHED] test [unoptimized + debuginfo] target(s) in [..]
509- [DOCTEST] foo
510- [RUNNING] `rustdoc [..] --check-cfg 'values()' [..]
511- " ,
512- )
427+ . with_stderr_contains ( x ! ( "rustc" => "values" ) )
428+ . with_stderr_contains ( x ! ( "rustdoc" => "values" ) )
513429 . run ( ) ;
514430}
515431
516- #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
517432#[ cargo_test]
518433fn features_doc ( ) {
519434 if !is_nightly ( ) {
@@ -540,12 +455,6 @@ fn features_doc() {
540455
541456 p. cargo ( "doc -v -Zcheck-cfg=features" )
542457 . masquerade_as_nightly_cargo ( )
543- . with_stderr (
544- "\
545- [DOCUMENTING] foo v0.1.0 [..]
546- [RUNNING] `rustdoc [..] --check-cfg 'values(feature, \" default\" , \" f_a\" , \" f_b\" )' [..]
547- [FINISHED] [..]
548- " ,
549- )
458+ . with_stderr_contains ( x ! ( "rustdoc" => "values" of "feature" with "default" "f_a" "f_b" ) )
550459 . run ( ) ;
551460}
0 commit comments