From 734f55da94c867ce37fa37af408dd4355f29d139 Mon Sep 17 00:00:00 2001 From: Jonas Diemer Date: Sun, 18 Sep 2022 21:15:35 +0200 Subject: Fixing (hopefully) issue with path on Windows --- tests/upload_files.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'tests/upload_files.rs') diff --git a/tests/upload_files.rs b/tests/upload_files.rs index 13e39ef..3900514 100644 --- a/tests/upload_files.rs +++ b/tests/upload_files.rs @@ -119,19 +119,17 @@ fn uploading_files_is_restricted(#[case] server: TestServer) -> Result<(), Error #[rstest] #[case(server(&["-u", "someDir"]), vec!["someDir".to_string()])] #[case(server(&["-u", "./-someDir"]), vec!["./-someDir".to_string()])] -#[case(server(&["-u", "someDir/some_sub_dir"]), vec!["someDir/some_sub_dir".to_string()])] -#[case(server(&["-u", "someDir/some_sub_dir", "-u", "someDir/some_other_dir"]), +#[case(server(&["-u", if cfg!(windows) {r"someDir\some_sub_dir"} else {"someDir/some_sub_dir"}]), + vec!["someDir/some_sub_dir".to_string()])] +#[case(server(&["-u", if cfg!(windows) {r"someDir\some_sub_dir"} else {"someDir/some_sub_dir"}, + "-u", if cfg!(windows) {r"someDir\some_other_dir"} else {"someDir/some_other_dir"}]), vec!["someDir/some_sub_dir".to_string(), "someDir/some_other_dir".to_string()])] fn uploading_files_to_allowed_dir_works( #[case] server: TestServer, - #[case] mut upload_dirs: Vec, + #[case] upload_dirs: Vec, ) -> Result<(), Error> { let test_file_name = "uploaded test file.txt"; - if cfg!(target_os = "windows") { - upload_dirs = upload_dirs.iter().map(|x| x.replace("/", "\\")).collect(); - } - for upload_dir in upload_dirs { // Create test directory create_dir_all(server.path().join(upload_dir.as_str())).unwrap(); -- cgit v1.2.3