mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 12:06:01 +01:00
Merge pull request #13891 from NixOS/another-url-test
Add another `fixGitURL` test
This commit is contained in:
commit
ab095c029c
1 changed files with 13 additions and 2 deletions
|
|
@ -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)
|
TEST(FixGitURLTestSuite, scpLikePathLeadingSlashParsesPoorly)
|
||||||
{
|
{
|
||||||
// SCP-like URL (no user)
|
// SCP-like URL (no user)
|
||||||
|
|
@ -246,8 +255,10 @@ TEST(parseURL, parsesFilePlusHttpsUrl)
|
||||||
|
|
||||||
TEST(parseURL, rejectsAuthorityInUrlsWithFileTransportation)
|
TEST(parseURL, rejectsAuthorityInUrlsWithFileTransportation)
|
||||||
{
|
{
|
||||||
auto s = "file://www.example.org/video.mp4";
|
EXPECT_THAT(
|
||||||
ASSERT_THROW(parseURL(s), Error);
|
[]() { parseURL("file://www.example.org/video.mp4"); },
|
||||||
|
::testing::ThrowsMessage<BadURL>(
|
||||||
|
testing::HasSubstrIgnoreANSIMatcher("has unexpected authority 'www.example.org'")));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(parseURL, parseIPv4Address)
|
TEST(parseURL, parseIPv4Address)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue