File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -4897,3 +4897,51 @@ fn cargo_test_print_env_verbose() {
4897
4897
)
4898
4898
. run ( ) ;
4899
4899
}
4900
+
4901
+ #[ cargo_test]
4902
+ fn cargo_test_set_out_dir_env_var ( ) {
4903
+ let p = project ( )
4904
+ . file (
4905
+ "Cargo.toml" ,
4906
+ r#"
4907
+ [package]
4908
+ name = "foo"
4909
+ version = "0.0.1"
4910
+ edition = "2021"
4911
+ "# ,
4912
+ )
4913
+ . file (
4914
+ "src/lib.rs" ,
4915
+ r#"
4916
+ pub fn add(left: usize, right: usize) -> usize {
4917
+ left + right
4918
+ }
4919
+ "# ,
4920
+ )
4921
+ . file (
4922
+ "build.rs" ,
4923
+ r#"
4924
+ fn main() {}
4925
+ "# ,
4926
+ )
4927
+ . file (
4928
+ "tests/case.rs" ,
4929
+ r#"
4930
+ #[cfg(test)]
4931
+ pub mod tests {
4932
+ #[test]
4933
+ fn test_add() {
4934
+ assert!(std::env::var("OUT_DIR").is_ok());
4935
+ assert_eq!(foo::add(2, 5), 7);
4936
+ }
4937
+ }
4938
+ "# ,
4939
+ )
4940
+ . build ( ) ;
4941
+
4942
+ p. cargo ( "test" ) . run ( ) ;
4943
+ p. cargo ( "test --package foo --test case -- tests::test_add --exact --nocapture" )
4944
+ . with_stdout_contains ( "test tests::test_add ... FAILED" )
4945
+ . with_status ( 101 )
4946
+ . run ( ) ;
4947
+ }
You can’t perform that action at this time.
0 commit comments