mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-24 14:56:15 +02:00
451f8a8c19
We'll revert this sometime later
37 lines
1 KiB
C++
37 lines
1 KiB
C++
#include <gtest/gtest.h>
|
|
|
|
#include "content-address.hh"
|
|
|
|
namespace nix {
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* ContentAddressMethod::parse, ContentAddressMethod::render
|
|
* --------------------------------------------------------------------------*/
|
|
|
|
TEST(ContentAddressMethod, testRoundTripPrintParse_1) {
|
|
for (ContentAddressMethod cam : {
|
|
ContentAddressMethod::Raw::Text,
|
|
ContentAddressMethod::Raw::Flat,
|
|
ContentAddressMethod::Raw::NixArchive,
|
|
ContentAddressMethod::Raw::Git,
|
|
}) {
|
|
EXPECT_EQ(ContentAddressMethod::parse(cam.render()), cam);
|
|
}
|
|
}
|
|
|
|
TEST(ContentAddressMethod, testRoundTripPrintParse_2) {
|
|
for (const std::string_view camS : {
|
|
"text",
|
|
"flat",
|
|
"nar",
|
|
"git",
|
|
}) {
|
|
EXPECT_EQ(ContentAddressMethod::parse(camS).render(), camS);
|
|
}
|
|
}
|
|
|
|
TEST(ContentAddressMethod, testParseContentAddressMethodOptException) {
|
|
EXPECT_THROW(ContentAddressMethod::parse("narwhal"), UsageError);
|
|
}
|
|
|
|
}
|