Update test

This commit is contained in:
Dialga 2024-01-07 22:57:10 +13:00 committed by GitHub
parent 15bfcebf18
commit 8921614656
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -573,14 +573,14 @@ mod tests {
// Create the file we want to test against ad-hoc. We can't check it in as otherwise // Create the file we want to test against ad-hoc. We can't check it in as otherwise
// Windows can't even checkout this repository. // Windows can't even checkout this repository.
let temp_dir = tempfile::tempdir().unwrap(); let temp_dir = tempfile::tempdir().unwrap();
let file_with_newlines = temp_dir.path().join("test\nnewline.text"); let file_with_newlines = temp_dir.path().join("test\n\x0B\x0C\rnewline.text");
fs::write(&file_with_newlines, "Look at my newlines").unwrap(); fs::write(&file_with_newlines, "Look at my newlines").unwrap();
let srv = test::init_service( let srv = test::init_service(
App::new().service(Files::new("/", temp_dir.path()).index_file("Cargo.toml")), App::new().service(Files::new("/", temp_dir.path()).index_file("Cargo.toml")),
) )
.await; .await;
let request = TestRequest::get().uri("/test%0Anewline.text").to_request(); let request = TestRequest::get().uri("/test%0A%0B%0C%0Dnewline.text").to_request();
let response = test::call_service(&srv, request).await; let response = test::call_service(&srv, request).await;
assert_eq!(response.status(), StatusCode::OK); assert_eq!(response.status(), StatusCode::OK);