mirror of
https://github.com/NixOS/nix
synced 2025-06-25 14:51:16 +02:00
Merge pull request #13097 from NixOS/mergify/bp/2.28-maintenance/pr-13094
libutil: Add missing format arguments to UsageError ctor (backport #13094)
This commit is contained in:
commit
323e840d17
2 changed files with 13 additions and 6 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
#include <gmock/gmock.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "nix/util/file-content-address.hh"
|
#include "nix/util/file-content-address.hh"
|
||||||
|
@ -26,8 +27,11 @@ TEST(FileSerialisationMethod, testRoundTripPrintParse_2) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(FileSerialisationMethod, testParseFileSerialisationMethodOptException) {
|
TEST(FileSerialisationMethod, testParseFileSerialisationMethodOptException)
|
||||||
EXPECT_THROW(parseFileSerialisationMethod("narwhal"), UsageError);
|
{
|
||||||
|
EXPECT_THAT(
|
||||||
|
[]() { parseFileSerialisationMethod("narwhal"); },
|
||||||
|
testing::ThrowsMessage<UsageError>(testing::HasSubstr("narwhal")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
|
@ -54,8 +58,11 @@ TEST(FileIngestionMethod, testRoundTripPrintParse_2) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(FileIngestionMethod, testParseFileIngestionMethodOptException) {
|
TEST(FileIngestionMethod, testParseFileIngestionMethodOptException)
|
||||||
EXPECT_THROW(parseFileIngestionMethod("narwhal"), UsageError);
|
{
|
||||||
|
EXPECT_THAT(
|
||||||
|
[]() { parseFileIngestionMethod("narwhal"); },
|
||||||
|
testing::ThrowsMessage<UsageError>(testing::HasSubstr("narwhal")));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ FileSerialisationMethod parseFileSerialisationMethod(std::string_view input)
|
||||||
if (ret)
|
if (ret)
|
||||||
return *ret;
|
return *ret;
|
||||||
else
|
else
|
||||||
throw UsageError("Unknown file serialiation method '%s', expect `flat` or `nar`");
|
throw UsageError("Unknown file serialiation method '%s', expect `flat` or `nar`", input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ FileIngestionMethod parseFileIngestionMethod(std::string_view input)
|
||||||
if (ret)
|
if (ret)
|
||||||
return static_cast<FileIngestionMethod>(*ret);
|
return static_cast<FileIngestionMethod>(*ret);
|
||||||
else
|
else
|
||||||
throw UsageError("Unknown file ingestion method '%s', expect `flat`, `nar`, or `git`");
|
throw UsageError("Unknown file ingestion method '%s', expect `flat`, `nar`, or `git`", input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue