@@ -2,7 +2,6 @@ use std::fmt::{self, Write};
22
33use glob:: glob;
44use support:: install:: exe;
5- use support:: is_nightly;
65use support:: paths:: CargoPathExt ;
76use support:: registry:: Package ;
87use support:: { basic_manifest, project} ;
@@ -573,39 +572,44 @@ fn check_artifacts() {
573572 . file ( "examples/ex1.rs" , "fn main() {}" )
574573 . file ( "benches/b1.rs" , "" )
575574 . 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+
576585 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( ) ) ;
578587 assert ! ( !p. root( ) . join( "target/debug/libfoo.rlib" ) . is_file( ) ) ;
579588 assert ! ( !p. root( ) . join( "target/debug" ) . join( exe( "foo" ) ) . is_file( ) ) ;
589+ assert_glob ( "target/debug/deps/libfoo-*.rmeta" , 2 ) ;
580590
581591 p. root ( ) . join ( "target" ) . rm_rf ( ) ;
582592 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( ) ) ;
584594 assert ! ( !p. root( ) . join( "target/debug/libfoo.rlib" ) . is_file( ) ) ;
585595 assert ! ( !p. root( ) . join( "target/debug" ) . join( exe( "foo" ) ) . is_file( ) ) ;
596+ assert_glob ( "target/debug/deps/libfoo-*.rmeta" , 1 ) ;
586597
587598 p. root ( ) . join ( "target" ) . rm_rf ( ) ;
588599 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( ) ) ;
595601 assert ! ( !p. root( ) . join( "target/debug/libfoo.rlib" ) . is_file( ) ) ;
596602 assert ! ( !p. root( ) . join( "target/debug" ) . join( exe( "foo" ) ) . is_file( ) ) ;
603+ assert_glob ( "target/debug/deps/libfoo-*.rmeta" , 2 ) ;
597604
598605 p. root ( ) . join ( "target" ) . rm_rf ( ) ;
599606 p. cargo ( "check --test t1" ) . run ( ) ;
600607 assert ! ( !p. root( ) . join( "target/debug/libfoo.rmeta" ) . is_file( ) ) ;
601608 assert ! ( !p. root( ) . join( "target/debug/libfoo.rlib" ) . is_file( ) ) ;
602609 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 ) ;
609613
610614 p. root ( ) . join ( "target" ) . rm_rf ( ) ;
611615 p. cargo ( "check --example ex1" ) . run ( ) ;
@@ -617,18 +621,17 @@ fn check_artifacts() {
617621 . join( exe( "ex1" ) )
618622 . is_file( )
619623 ) ;
624+ assert_glob ( "target/debug/deps/libfoo-*.rmeta" , 1 ) ;
625+ assert_glob ( "target/debug/examples/libex1-*.rmeta" , 1 ) ;
620626
621627 p. root ( ) . join ( "target" ) . rm_rf ( ) ;
622628 p. cargo ( "check --bench b1" ) . run ( ) ;
623629 assert ! ( !p. root( ) . join( "target/debug/libfoo.rmeta" ) . is_file( ) ) ;
624630 assert ! ( !p. root( ) . join( "target/debug/libfoo.rlib" ) . is_file( ) ) ;
625631 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 ) ;
632635}
633636
634637#[ test]
0 commit comments