mirror of
https://github.com/NixOS/nix
synced 2025-07-07 14:21:48 +02:00
Add Git object hashing to the store layer
Part of RFC 133 Extracted from our old IPFS branches. Co-Authored-By: Matthew Bauer <mjbauer95@gmail.com> Co-Authored-By: Carlo Nucera <carlo.nucera@protonmail.com> Co-authored-by: Robert Hensing <roberth@users.noreply.github.com> Co-authored-by: Florian Klink <flokli@flokli.de>
This commit is contained in:
parent
04836c73e5
commit
201551c937
27 changed files with 484 additions and 86 deletions
|
@ -13,6 +13,7 @@ TEST(ContentAddressMethod, testRoundTripPrintParse_1) {
|
|||
ContentAddressMethod { TextIngestionMethod {} },
|
||||
ContentAddressMethod { FileIngestionMethod::Flat },
|
||||
ContentAddressMethod { FileIngestionMethod::Recursive },
|
||||
ContentAddressMethod { FileIngestionMethod::Git },
|
||||
}) {
|
||||
EXPECT_EQ(ContentAddressMethod::parse(cam.render()), cam);
|
||||
}
|
||||
|
@ -23,6 +24,7 @@ TEST(ContentAddressMethod, testRoundTripPrintParse_2) {
|
|||
"text",
|
||||
"flat",
|
||||
"nar",
|
||||
"git",
|
||||
}) {
|
||||
EXPECT_EQ(ContentAddressMethod::parse(camS).render(), camS);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,32 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* parseFileSerialisationMethod, renderFileSerialisationMethod
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
TEST(FileSerialisationMethod, testRoundTripPrintParse_1) {
|
||||
for (const FileSerialisationMethod fim : {
|
||||
FileSerialisationMethod::Flat,
|
||||
FileSerialisationMethod::Recursive,
|
||||
}) {
|
||||
EXPECT_EQ(parseFileSerialisationMethod(renderFileSerialisationMethod(fim)), fim);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(FileSerialisationMethod, testRoundTripPrintParse_2) {
|
||||
for (const std::string_view fimS : {
|
||||
"flat",
|
||||
"nar",
|
||||
}) {
|
||||
EXPECT_EQ(renderFileSerialisationMethod(parseFileSerialisationMethod(fimS)), fimS);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(FileSerialisationMethod, testParseFileSerialisationMethodOptException) {
|
||||
EXPECT_THROW(parseFileSerialisationMethod("narwhal"), UsageError);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* parseFileIngestionMethod, renderFileIngestionMethod
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
@ -12,6 +38,7 @@ TEST(FileIngestionMethod, testRoundTripPrintParse_1) {
|
|||
for (const FileIngestionMethod fim : {
|
||||
FileIngestionMethod::Flat,
|
||||
FileIngestionMethod::Recursive,
|
||||
FileIngestionMethod::Git,
|
||||
}) {
|
||||
EXPECT_EQ(parseFileIngestionMethod(renderFileIngestionMethod(fim)), fim);
|
||||
}
|
||||
|
@ -21,6 +48,7 @@ TEST(FileIngestionMethod, testRoundTripPrintParse_2) {
|
|||
for (const std::string_view fimS : {
|
||||
"flat",
|
||||
"nar",
|
||||
"git",
|
||||
}) {
|
||||
EXPECT_EQ(renderFileIngestionMethod(parseFileIngestionMethod(fimS)), fimS);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue