aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/mod.rs2
-rw-r--r--tests/serve_request.rs9
2 files changed, 9 insertions, 2 deletions
diff --git a/tests/fixtures/mod.rs b/tests/fixtures/mod.rs
index cec912a..49ed7bd 100644
--- a/tests/fixtures/mod.rs
+++ b/tests/fixtures/mod.rs
@@ -8,7 +8,7 @@ pub type Error = Box<dyn std::error::Error>;
/// File names for testing purpose
#[allow(dead_code)]
-pub static FILES: &[&str] = &["test.txt", "test.html", "test.mkv"];
+pub static FILES: &[&str] = &["test.txt", "test.html", "test.mkv", "test \" \' & < >.csv"];
/// Directory names for testing purpose
#[allow(dead_code)]
diff --git a/tests/serve_request.rs b/tests/serve_request.rs
index cc0e059..43b16a0 100644
--- a/tests/serve_request.rs
+++ b/tests/serve_request.rs
@@ -45,9 +45,16 @@ fn serves_requests_with_non_default_port(tmpdir: TempDir, port: u16) -> Result<(
let body = reqwest::blocking::get(format!("http://localhost:{}", port).as_str())?
.error_for_status()?;
let parsed = Document::from_read(body)?;
+
for &file in FILES {
- assert!(parsed.find(|x: &Node| x.text() == file).next().is_some());
+ let f = parsed.find(|x: &Node| x.text() == file).next().unwrap();
+ dbg!(f.attr("href"));
+ assert_eq!(
+ format!("/{}", file),
+ percent_encoding::percent_decode_str(f.attr("href").unwrap()).decode_utf8_lossy(),
+ );
}
+
for &directory in DIRECTORIES {
assert!(parsed
.find(|x: &Node| x.text() == directory)