aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/libstore
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-03-29 20:26:38 -0700
committerJade Lovelace <lix@jade.fyi>2024-03-29 20:26:38 -0700
commit1fa6a3e3354bd98707303476b5a54147ccdd533a (patch)
treec3804cca7a9ec266de780019a95180e20387c92f /tests/unit/libstore
parent99f159c5367e423097fe4347375bdfc4f76d2c0c (diff)
Fix various clang-tidy lints
* some things that can throw are marked noexcept yet the linter seems to think not. Maybe they can't throw in practice. I would rather not have the UB possibility in pretty obvious cold paths. * various default-case-missing complaints * a fair pile of casts from integer to character, which are in fact deliberate. * an instance of <https://clang.llvm.org/extra/clang-tidy/checks/bugprone/move-forwarding-reference.html> * bugprone-not-null-terminated-result on handing a string to curl in chunks of bytes. our usage is fine. * reassigning a unique_ptr by CRIMES instead of using release(), then using release() and ignoring the result. wild. let's use release() for its intended purpose. Change-Id: Ic3e7affef12383576213a8a7c8145c27e662513d
Diffstat (limited to 'tests/unit/libstore')
-rw-r--r--tests/unit/libstore/outputs-spec.cc30
1 files changed, 16 insertions, 14 deletions
diff --git a/tests/unit/libstore/outputs-spec.cc b/tests/unit/libstore/outputs-spec.cc
index 63cde681b..72a7da974 100644
--- a/tests/unit/libstore/outputs-spec.cc
+++ b/tests/unit/libstore/outputs-spec.cc
@@ -170,20 +170,22 @@ TEST(ExtendedOutputsSpec, many_carrot) {
}
-#define TEST_JSON(TYPE, NAME, STR, VAL) \
- \
- TEST(TYPE, NAME ## _to_json) { \
- using nlohmann::literals::operator "" _json; \
- ASSERT_EQ( \
- STR ## _json, \
- ((nlohmann::json) TYPE { VAL })); \
- } \
- \
- TEST(TYPE, NAME ## _from_json) { \
- using nlohmann::literals::operator "" _json; \
- ASSERT_EQ( \
- TYPE { VAL }, \
- (STR ## _json).get<TYPE>()); \
+#define TEST_JSON(TYPE, NAME, STR, VAL) \
+ \
+ TEST(TYPE, NAME ## _to_json) { \
+ using nlohmann::literals::operator "" _json; \
+ ASSERT_EQ( \
+ STR ## _json, \
+ /* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
+ ((nlohmann::json) TYPE { VAL })); \
+ } \
+ \
+ TEST(TYPE, NAME ## _from_json) { \
+ using nlohmann::literals::operator "" _json; \
+ ASSERT_EQ( \
+ /* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
+ TYPE { VAL }, \
+ (STR ## _json).get<TYPE>()); \
}
TEST_JSON(OutputsSpec, all, R"(["*"])", OutputsSpec::All { })