aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/libstore/filetransfer.cc3
-rw-r--r--tests/unit/libutil/closure.cc2
-rw-r--r--tests/unit/libutil/generator.cc5
-rw-r--r--tests/unit/libutil/tests.cc6
4 files changed, 10 insertions, 6 deletions
diff --git a/tests/unit/libstore/filetransfer.cc b/tests/unit/libstore/filetransfer.cc
index 6e8cf3bbe..71e7392fc 100644
--- a/tests/unit/libstore/filetransfer.cc
+++ b/tests/unit/libstore/filetransfer.cc
@@ -6,7 +6,6 @@
#include <future>
#include <gtest/gtest.h>
#include <netinet/in.h>
-#include <stdexcept>
#include <string>
#include <string_view>
#include <sys/poll.h>
@@ -130,7 +129,7 @@ serveHTTP(std::string status, std::string headers, std::function<std::string()>
TEST(FileTransfer, exceptionAbortsDownload)
{
- struct Done
+ struct Done : std::exception
{};
auto ft = makeFileTransfer();
diff --git a/tests/unit/libutil/closure.cc b/tests/unit/libutil/closure.cc
index b4eaad6f9..8cac9a9fd 100644
--- a/tests/unit/libutil/closure.cc
+++ b/tests/unit/libutil/closure.cc
@@ -28,7 +28,7 @@ TEST(closure, correctClosure) {
}
TEST(closure, properlyHandlesDirectExceptions) {
- struct TestExn {};
+ struct TestExn : std::exception {};
EXPECT_THROW(
computeClosure<string>(
{"A"},
diff --git a/tests/unit/libutil/generator.cc b/tests/unit/libutil/generator.cc
index 800e6ca8a..22cc085f9 100644
--- a/tests/unit/libutil/generator.cc
+++ b/tests/unit/libutil/generator.cc
@@ -85,6 +85,7 @@ TEST(Generator, nestsExceptions)
co_yield 1;
co_yield []() -> Generator<int> {
co_yield 9;
+ // NOLINTNEXTLINE(hicpp-exception-baseclass)
throw 1;
co_yield 10;
}();
@@ -101,6 +102,7 @@ TEST(Generator, exception)
{
auto g = []() -> Generator<int> {
co_yield 1;
+ // NOLINTNEXTLINE(hicpp-exception-baseclass)
throw 1;
}();
@@ -110,6 +112,7 @@ TEST(Generator, exception)
}
{
auto g = []() -> Generator<int> {
+ // NOLINTNEXTLINE(hicpp-exception-baseclass)
throw 1;
co_return;
}();
@@ -173,11 +176,13 @@ struct ThrowTransform
int operator()(bool)
{
+ // NOLINTNEXTLINE(hicpp-exception-baseclass)
throw 2;
}
Generator<int, void> operator()(Generator<int> && inner)
{
+ // NOLINTNEXTLINE(hicpp-exception-baseclass)
throw false;
}
};
diff --git a/tests/unit/libutil/tests.cc b/tests/unit/libutil/tests.cc
index 9a44ad59b..29a5f7164 100644
--- a/tests/unit/libutil/tests.cc
+++ b/tests/unit/libutil/tests.cc
@@ -29,12 +29,12 @@ namespace nix {
char cwd[PATH_MAX+1];
auto p = absPath("");
- ASSERT_EQ(p, getcwd((char*)&cwd, PATH_MAX));
+ ASSERT_EQ(p, getcwd(cwd, PATH_MAX));
}
TEST(absPath, usesOptionalBasePathWhenGiven) {
char _cwd[PATH_MAX+1];
- char* cwd = getcwd((char*)&_cwd, PATH_MAX);
+ char* cwd = getcwd(_cwd, PATH_MAX);
auto p = absPath("", cwd);
@@ -43,7 +43,7 @@ namespace nix {
TEST(absPath, isIdempotent) {
char _cwd[PATH_MAX+1];
- char* cwd = getcwd((char*)&_cwd, PATH_MAX);
+ char* cwd = getcwd(_cwd, PATH_MAX);
auto p1 = absPath(cwd);
auto p2 = absPath(p1);