aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/libutil
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/libutil')
-rw-r--r--tests/unit/libutil/closure.cc2
-rw-r--r--tests/unit/libutil/generator.cc5
-rw-r--r--tests/unit/libutil/tests.cc6
3 files changed, 9 insertions, 4 deletions
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);