File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1
1
extern crate cargo;
2
+ #[ macro_use]
2
3
extern crate cargotest;
3
4
extern crate hamcrest;
4
5
extern crate tempdir;
@@ -3271,3 +3272,32 @@ fn no_bin_in_src_with_lib() {
3271
3272
execs ( ) . with_status ( 101 )
3272
3273
. with_stderr_contains ( r#"[ERROR] couldn't read "[..]main.rs"[..]"# ) ) ;
3273
3274
}
3275
+
3276
+ #[ test]
3277
+ fn same_metadata_different_directory ( ) {
3278
+ // A top-level crate built in two different workspaces should have the
3279
+ // same metadata hash.
3280
+ let p = project ( "foo1" )
3281
+ . file ( "Cargo.toml" , & basic_bin_manifest ( "foo" ) )
3282
+ . file ( "src/foo.rs" , & main_file ( r#""i am foo""# , & [ ] ) ) ;
3283
+ let output = t ! ( String :: from_utf8(
3284
+ t!( p. cargo_process( "build" ) . arg( "-v" ) . exec_with_output( ) )
3285
+ . stderr,
3286
+ ) ) ;
3287
+ let metadata = output
3288
+ . split_whitespace ( )
3289
+ . filter ( |arg| arg. starts_with ( "metadata=" ) )
3290
+ . next ( )
3291
+ . unwrap ( ) ;
3292
+
3293
+ let p = project ( "foo2" )
3294
+ . file ( "Cargo.toml" , & basic_bin_manifest ( "foo" ) )
3295
+ . file ( "src/foo.rs" , & main_file ( r#""i am foo""# , & [ ] ) ) ;
3296
+
3297
+ assert_that (
3298
+ p. cargo_process ( "build" ) . arg ( "-v" ) ,
3299
+ execs ( ) . with_status ( 0 ) . with_stderr_contains (
3300
+ format ! ( "[..]{}[..]" , metadata) ,
3301
+ ) ,
3302
+ ) ;
3303
+ }
You can’t perform that action at this time.
0 commit comments