mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-26 07:46:21 +02:00
41dd9857c7
No outward facing behavior is changed. Older methods with same names that operate on on method + algo pair (for old-style `<method>:algo`) are renamed to `*WithAlgo`.) The functions are unit-tested in the same way the names for the hash algorithms are tested.
33 lines
939 B
C++
33 lines
939 B
C++
#include <gtest/gtest.h>
|
|
|
|
#include "file-content-address.hh"
|
|
|
|
namespace nix {
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* parseFileIngestionMethod, renderFileIngestionMethod
|
|
* --------------------------------------------------------------------------*/
|
|
|
|
TEST(FileIngestionMethod, testRoundTripPrintParse_1) {
|
|
for (const FileIngestionMethod fim : {
|
|
FileIngestionMethod::Flat,
|
|
FileIngestionMethod::Recursive,
|
|
}) {
|
|
EXPECT_EQ(parseFileIngestionMethod(renderFileIngestionMethod(fim)), fim);
|
|
}
|
|
}
|
|
|
|
TEST(FileIngestionMethod, testRoundTripPrintParse_2) {
|
|
for (const std::string_view fimS : {
|
|
"flat",
|
|
"nar",
|
|
}) {
|
|
EXPECT_EQ(renderFileIngestionMethod(parseFileIngestionMethod(fimS)), fimS);
|
|
}
|
|
}
|
|
|
|
TEST(FileIngestionMethod, testParseFileIngestionMethodOptException) {
|
|
EXPECT_THROW(parseFileIngestionMethod("narwhal"), UsageError);
|
|
}
|
|
|
|
}
|