File tree 1 file changed +88
-0
lines changed
1 file changed +88
-0
lines changed Original file line number Diff line number Diff line change @@ -317,6 +317,94 @@ fn well_known_names_values_doctest() {
317
317
. run ( ) ;
318
318
}
319
319
320
+ #[ cargo_test]
321
+ fn test_false_lib ( ) {
322
+ let p = project ( )
323
+ . file (
324
+ "Cargo.toml" ,
325
+ r#"
326
+ [package]
327
+ name = "foo"
328
+ version = "0.1.0"
329
+ edition = "2018"
330
+
331
+ [lib]
332
+ test = false
333
+ "# ,
334
+ )
335
+ . file ( "src/lib.rs" , "" )
336
+ . build ( ) ;
337
+
338
+ p. cargo ( "check -v" )
339
+ . with_stderr_contains ( x ! ( "rustc" => "cfg" of "docsrs,test" ) )
340
+ . run ( ) ;
341
+
342
+ p. cargo ( "clean" ) . run ( ) ;
343
+ p. cargo ( "test -v" )
344
+ . with_stderr_contains ( x ! ( "rustc" => "cfg" of "docsrs,test" ) )
345
+ . run ( ) ;
346
+
347
+ p. cargo ( "clean" ) . run ( ) ;
348
+ p. cargo ( "test --lib -v" )
349
+ . with_stderr_contains ( x ! ( "rustc" => "cfg" of "docsrs,test" ) )
350
+ . run ( ) ;
351
+ }
352
+
353
+ #[ cargo_test]
354
+ fn test_false_bins ( ) {
355
+ let p = project ( )
356
+ . file (
357
+ "Cargo.toml" ,
358
+ r#"
359
+ [package]
360
+ name = "foo"
361
+ version = "0.1.0"
362
+ edition = "2018"
363
+
364
+ [[bin]]
365
+ name = "daemon"
366
+ test = false
367
+ path = "src/deamon.rs"
368
+ "# ,
369
+ )
370
+ . file ( "src/main.rs" , "fn main() {}" )
371
+ . file ( "src/deamon.rs" , "fn main() {}" )
372
+ . build ( ) ;
373
+
374
+ p. cargo ( "check -v" )
375
+ . with_stderr_contains ( x ! ( "rustc" => "cfg" of "docsrs,test" ) ) // for foo & deamon
376
+ . run ( ) ;
377
+ }
378
+
379
+ #[ cargo_test]
380
+ fn test_false_examples ( ) {
381
+ let p = project ( )
382
+ . file (
383
+ "Cargo.toml" ,
384
+ r#"
385
+ [package]
386
+ name = "foo"
387
+ version = "0.1.0"
388
+ edition = "2018"
389
+
390
+ [lib]
391
+ test = false
392
+
393
+ [[example]]
394
+ name = "daemon"
395
+ test = false
396
+ path = "src/deamon.rs"
397
+ "# ,
398
+ )
399
+ . file ( "src/lib.rs" , "" )
400
+ . file ( "src/deamon.rs" , "fn main() {}" )
401
+ . build ( ) ;
402
+
403
+ p. cargo ( "check --examples -v" )
404
+ . with_stderr_contains ( x ! ( "rustc" => "cfg" of "docsrs,test" ) )
405
+ . run ( ) ;
406
+ }
407
+
320
408
#[ cargo_test]
321
409
fn features_doc ( ) {
322
410
let p = project ( )
You can’t perform that action at this time.
0 commit comments