@@ -2,7 +2,6 @@ use std::fmt::{self, Write};
2
2
3
3
use glob:: glob;
4
4
use support:: install:: exe;
5
- use support:: is_nightly;
6
5
use support:: paths:: CargoPathExt ;
7
6
use support:: registry:: Package ;
8
7
use support:: { basic_manifest, project} ;
@@ -573,39 +572,44 @@ fn check_artifacts() {
573
572
. file ( "examples/ex1.rs" , "fn main() {}" )
574
573
. file ( "benches/b1.rs" , "" )
575
574
. build ( ) ;
575
+
576
+ let assert_glob = |path : & str , count : usize | {
577
+ assert_eq ! (
578
+ glob( & p. root( ) . join( path) . to_str( ) . unwrap( ) )
579
+ . unwrap( )
580
+ . count( ) ,
581
+ count
582
+ ) ;
583
+ } ;
584
+
576
585
p. cargo ( "check" ) . run ( ) ;
577
- assert ! ( p. root( ) . join( "target/debug/libfoo.rmeta" ) . is_file( ) ) ;
586
+ assert ! ( ! p. root( ) . join( "target/debug/libfoo.rmeta" ) . is_file( ) ) ;
578
587
assert ! ( !p. root( ) . join( "target/debug/libfoo.rlib" ) . is_file( ) ) ;
579
588
assert ! ( !p. root( ) . join( "target/debug" ) . join( exe( "foo" ) ) . is_file( ) ) ;
589
+ assert_glob ( "target/debug/deps/libfoo-*.rmeta" , 2 ) ;
580
590
581
591
p. root ( ) . join ( "target" ) . rm_rf ( ) ;
582
592
p. cargo ( "check --lib" ) . run ( ) ;
583
- assert ! ( p. root( ) . join( "target/debug/libfoo.rmeta" ) . is_file( ) ) ;
593
+ assert ! ( ! p. root( ) . join( "target/debug/libfoo.rmeta" ) . is_file( ) ) ;
584
594
assert ! ( !p. root( ) . join( "target/debug/libfoo.rlib" ) . is_file( ) ) ;
585
595
assert ! ( !p. root( ) . join( "target/debug" ) . join( exe( "foo" ) ) . is_file( ) ) ;
596
+ assert_glob ( "target/debug/deps/libfoo-*.rmeta" , 1 ) ;
586
597
587
598
p. root ( ) . join ( "target" ) . rm_rf ( ) ;
588
599
p. cargo ( "check --bin foo" ) . run ( ) ;
589
- if is_nightly ( ) {
590
- // The nightly check can be removed once 1.27 is stable.
591
- // Bins now generate `rmeta` files.
592
- // See: https://github.com/rust-lang/rust/pull/49289
593
- assert ! ( p. root( ) . join( "target/debug/libfoo.rmeta" ) . is_file( ) ) ;
594
- }
600
+ assert ! ( !p. root( ) . join( "target/debug/libfoo.rmeta" ) . is_file( ) ) ;
595
601
assert ! ( !p. root( ) . join( "target/debug/libfoo.rlib" ) . is_file( ) ) ;
596
602
assert ! ( !p. root( ) . join( "target/debug" ) . join( exe( "foo" ) ) . is_file( ) ) ;
603
+ assert_glob ( "target/debug/deps/libfoo-*.rmeta" , 2 ) ;
597
604
598
605
p. root ( ) . join ( "target" ) . rm_rf ( ) ;
599
606
p. cargo ( "check --test t1" ) . run ( ) ;
600
607
assert ! ( !p. root( ) . join( "target/debug/libfoo.rmeta" ) . is_file( ) ) ;
601
608
assert ! ( !p. root( ) . join( "target/debug/libfoo.rlib" ) . is_file( ) ) ;
602
609
assert ! ( !p. root( ) . join( "target/debug" ) . join( exe( "foo" ) ) . is_file( ) ) ;
603
- assert_eq ! (
604
- glob( & p. root( ) . join( "target/debug/t1-*" ) . to_str( ) . unwrap( ) )
605
- . unwrap( )
606
- . count( ) ,
607
- 0
608
- ) ;
610
+ assert_glob ( "target/debug/t1-*" , 0 ) ;
611
+ assert_glob ( "target/debug/deps/libfoo-*.rmeta" , 1 ) ;
612
+ assert_glob ( "target/debug/deps/libt1-*.rmeta" , 1 ) ;
609
613
610
614
p. root ( ) . join ( "target" ) . rm_rf ( ) ;
611
615
p. cargo ( "check --example ex1" ) . run ( ) ;
@@ -617,18 +621,17 @@ fn check_artifacts() {
617
621
. join( exe( "ex1" ) )
618
622
. is_file( )
619
623
) ;
624
+ assert_glob ( "target/debug/deps/libfoo-*.rmeta" , 1 ) ;
625
+ assert_glob ( "target/debug/examples/libex1-*.rmeta" , 1 ) ;
620
626
621
627
p. root ( ) . join ( "target" ) . rm_rf ( ) ;
622
628
p. cargo ( "check --bench b1" ) . run ( ) ;
623
629
assert ! ( !p. root( ) . join( "target/debug/libfoo.rmeta" ) . is_file( ) ) ;
624
630
assert ! ( !p. root( ) . join( "target/debug/libfoo.rlib" ) . is_file( ) ) ;
625
631
assert ! ( !p. root( ) . join( "target/debug" ) . join( exe( "foo" ) ) . is_file( ) ) ;
626
- assert_eq ! (
627
- glob( & p. root( ) . join( "target/debug/b1-*" ) . to_str( ) . unwrap( ) )
628
- . unwrap( )
629
- . count( ) ,
630
- 0
631
- ) ;
632
+ assert_glob ( "target/debug/b1-*" , 0 ) ;
633
+ assert_glob ( "target/debug/deps/libfoo-*.rmeta" , 1 ) ;
634
+ assert_glob ( "target/debug/deps/libb1-*.rmeta" , 1 ) ;
632
635
}
633
636
634
637
#[ test]
0 commit comments