2023-08-17 23:40:57 +03:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
2024-07-01 20:37:30 +03:00
|
|
|
#include "fetch-settings.hh"
|
2023-08-17 23:40:57 +03:00
|
|
|
#include "flake/flakeref.hh"
|
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
/* ----------- tests for flake/flakeref.hh --------------------------------------------------*/
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* to_string
|
|
|
|
* --------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
TEST(to_string, doesntReencodeUrl) {
|
2024-07-01 20:37:30 +03:00
|
|
|
fetchers::Settings fetchSettings;
|
2023-08-17 23:40:57 +03:00
|
|
|
auto s = "http://localhost:8181/test/+3d.tar.gz";
|
2024-07-01 20:37:30 +03:00
|
|
|
auto flakeref = parseFlakeRef(fetchSettings, s);
|
2023-08-17 23:40:57 +03:00
|
|
|
auto parsed = flakeref.to_string();
|
|
|
|
auto expected = "http://localhost:8181/test/%2B3d.tar.gz";
|
|
|
|
|
|
|
|
ASSERT_EQ(parsed, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|