File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,16 @@ pub fn hex_to_id(hex: &str) -> git_hash::ObjectId {
29
29
pub fn fixture_path ( path : impl AsRef < Path > ) -> PathBuf {
30
30
PathBuf :: from ( "tests" ) . join ( "fixtures" ) . join ( path. as_ref ( ) )
31
31
}
32
+
33
+ pub fn crate_under_test ( ) -> String {
34
+ std:: env:: current_dir ( )
35
+ . expect ( "CWD is valid" )
36
+ . file_name ( )
37
+ . expect ( "typical cargo invocation" )
38
+ . to_string_lossy ( )
39
+ . into_owned ( )
40
+ }
41
+
32
42
pub fn fixture_bytes ( path : impl AsRef < Path > ) -> Vec < u8 > {
33
43
match std:: fs:: read ( fixture_path ( path. as_ref ( ) ) ) {
34
44
Ok ( res) => res,
@@ -97,7 +107,9 @@ pub fn scripted_fixture_repo_read_only_with_args(
97
107
98
108
let script_basename = script_name. file_stem ( ) . unwrap_or ( script_name. as_os_str ( ) ) ;
99
109
let archive_file_path = fixture_path (
100
- Path :: new ( "generated-archives" ) . join ( format ! ( "{}.tar.xz" , script_basename. to_str( ) . expect( "valid UTF-8" ) ) ) ,
110
+ Path :: new ( "generated-archives" )
111
+ . join ( crate_under_test ( ) )
112
+ . join ( format ! ( "{}.tar.xz" , script_basename. to_str( ) . expect( "valid UTF-8" ) ) ) ,
101
113
) ;
102
114
let script_result_directory = fixture_path (
103
115
Path :: new ( "generated-do-not-edit" )
You can’t perform that action at this time.
0 commit comments