File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -4954,3 +4954,34 @@ local-time = 1979-05-27
4954
4954
)
4955
4955
. run ( ) ;
4956
4956
}
4957
+
4958
+ #[ cargo_test]
4959
+ fn metadata_ignores_build_target_configuration ( ) -> anyhow:: Result < ( ) > {
4960
+ let p = project ( )
4961
+ . file (
4962
+ "Cargo.toml" ,
4963
+ r#"
4964
+ [package]
4965
+ name = "foo"
4966
+
4967
+ [target.'cfg(something)'.dependencies]
4968
+ foobar = "0.0.1"
4969
+ "# ,
4970
+ )
4971
+ . file ( "src/lib.rs" , "" )
4972
+ . build ( ) ;
4973
+ Package :: new ( "foobar" , "0.0.1" ) . publish ( ) ;
4974
+
4975
+ let output1 = p
4976
+ . cargo ( "metadata -q --format-version 1" )
4977
+ . exec_with_output ( ) ?;
4978
+ let output2 = p
4979
+ . cargo ( "metadata -q --format-version 1" )
4980
+ . env ( "CARGO_BUILD_TARGET" , rustc_host ( ) )
4981
+ . exec_with_output ( ) ?;
4982
+ assert ! (
4983
+ output1. stdout != output2. stdout,
4984
+ "metadata should change when `CARGO_BUILD_TARGET` is set" ,
4985
+ ) ;
4986
+ Ok ( ( ) )
4987
+ }
You can’t perform that action at this time.
0 commit comments