mirror of
https://github.com/NixOS/nix.git
synced 2025-11-10 04:26:01 +01:00
Merge pull request #13445 from xokdvium/simplify-util-url
libutil: Use Boost.URL for URI parsing
This commit is contained in:
commit
c7af923865
12 changed files with 192 additions and 81 deletions
|
|
@ -1,5 +1,7 @@
|
|||
#include "nix/util/url.hh"
|
||||
#include "nix/util/tests/gmock-matchers.hh"
|
||||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
|
@ -122,9 +124,9 @@ TEST(parseURL, parseIPv4Address)
|
|||
ASSERT_EQ(parsed, expected);
|
||||
}
|
||||
|
||||
TEST(parseURL, parseScopedRFC4007IPv6Address)
|
||||
TEST(parseURL, parseScopedRFC6874IPv6Address)
|
||||
{
|
||||
auto s = "http://[fe80::818c:da4d:8975:415c\%enp0s25]:8080";
|
||||
auto s = "http://[fe80::818c:da4d:8975:415c\%25enp0s25]:8080";
|
||||
auto parsed = parseURL(s);
|
||||
|
||||
ParsedURL expected{
|
||||
|
|
@ -289,6 +291,14 @@ TEST(percentDecode, trailingPercent)
|
|||
ASSERT_EQ(d, s);
|
||||
}
|
||||
|
||||
TEST(percentDecode, incompleteEncoding)
|
||||
{
|
||||
ASSERT_THAT(
|
||||
[]() { percentDecode("%1"); },
|
||||
::testing::ThrowsMessage<BadURL>(
|
||||
testing::HasSubstrIgnoreANSIMatcher("error: invalid URI parameter '%1': incomplete pct-encoding")));
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* percentEncode
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue