From eace65a472f5a92619e3347ec936164022d3f23e Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 22 Feb 2025 18:48:40 +0100 Subject: [PATCH] test: add tests for URL extraction ending with a period --- fixtures/LINK_PERIOD.html | 1 + lychee-bin/tests/cli.rs | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 fixtures/LINK_PERIOD.html diff --git a/fixtures/LINK_PERIOD.html b/fixtures/LINK_PERIOD.html new file mode 100644 index 0000000000..9aaebaf98a --- /dev/null +++ b/fixtures/LINK_PERIOD.html @@ -0,0 +1 @@ +link diff --git a/lychee-bin/tests/cli.rs b/lychee-bin/tests/cli.rs index 6b76be583e..2e4dd012a1 100644 --- a/lychee-bin/tests/cli.rs +++ b/lychee-bin/tests/cli.rs @@ -1990,4 +1990,29 @@ mod cli { Ok(()) } + + #[test] + fn test_extract_url_ending_with_period_file() { + let test_path = fixtures_path().join("LINK_PERIOD.html"); + + let mut cmd = main_command(); + cmd.arg("--dump") + .arg(test_path) + .assert() + .success() + .stdout(contains("https://www.example.com/smth.")); + } + + #[tokio::test] + async fn test_extract_url_ending_with_period_webserver() { + let mut cmd = main_command(); + let body = r#"link"#; + let mock_server = mock_response!(body); + + cmd.arg("--dump") + .arg(mock_server.uri()) + .assert() + .success() + .stdout(contains("https://www.example.com/smth.")); + } }