1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 19:46:02 +01:00

Merge pull request #13891 from NixOS/another-url-test

Add another `fixGitURL` test
This commit is contained in:
John Ericson 2025-09-01 17:36:18 -04:00 committed by GitHub
commit ab095c029c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -127,6 +127,15 @@ TEST(FixGitURLTestSuite, scpLikeNoUserParsesPoorly)
}));
}
TEST(FixGitURLTestSuite, properlyRejectFileURLWithAuthority)
{
/* From the underlying `parseURL` validations. */
EXPECT_THAT(
[]() { fixGitURL("file://var/repos/x"); },
::testing::ThrowsMessage<BadURL>(
testing::HasSubstrIgnoreANSIMatcher("file:// URL 'file://var/repos/x' has unexpected authority 'var'")));
}
TEST(FixGitURLTestSuite, scpLikePathLeadingSlashParsesPoorly)
{
// SCP-like URL (no user)
@ -246,8 +255,10 @@ TEST(parseURL, parsesFilePlusHttpsUrl)
TEST(parseURL, rejectsAuthorityInUrlsWithFileTransportation)
{
auto s = "file://www.example.org/video.mp4";
ASSERT_THROW(parseURL(s), Error);
EXPECT_THAT(
[]() { parseURL("file://www.example.org/video.mp4"); },
::testing::ThrowsMessage<BadURL>(
testing::HasSubstrIgnoreANSIMatcher("has unexpected authority 'www.example.org'")));
}
TEST(parseURL, parseIPv4Address)