diff options
author | jade <lix@jade.fyi> | 2024-03-31 15:38:48 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@lix> | 2024-03-31 15:38:48 +0000 |
commit | 73507a716761241ca38d35fb6a873c43967c8139 (patch) | |
tree | 3e05db96d19a6c0fd683357cfff269be8a0e42d5 /tests/unit | |
parent | 6165f210742d74dc7d74b011cc6f782d59c2f407 (diff) | |
parent | 194a1b91af6d8848e4cc0dfbdcc153ee2dbed140 (diff) |
Merge changes Ib62d3d68,Ic3e7affe into main
* changes:
Make things that can throw not noexcept anymore
Fix various clang-tidy lints
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/libstore-support/tests/path.cc | 6 | ||||
-rw-r--r-- | tests/unit/libstore/outputs-spec.cc | 30 | ||||
-rw-r--r-- | tests/unit/libutil-support/tests/terminal-code-eater.cc | 1 |
3 files changed, 20 insertions, 17 deletions
diff --git a/tests/unit/libstore-support/tests/path.cc b/tests/unit/libstore-support/tests/path.cc index 8bf501ab6..ffc4fc607 100644 --- a/tests/unit/libstore-support/tests/path.cc +++ b/tests/unit/libstore-support/tests/path.cc @@ -32,13 +32,13 @@ Gen<StorePathName> Arbitrary<StorePathName>::arbitrary() for (size_t c = 0; c < len; ++c) { switch (auto i = *gen::inRange<uint8_t>(0, 10 + 2 * 26 + 6)) { case 0 ... 9: - pre += '0' + i; + pre += static_cast<uint8_t>('0' + i); break; case 10 ... 35: - pre += 'A' + (i - 10); + pre += static_cast<uint8_t>('A' + (i - 10)); break; case 36 ... 61: - pre += 'a' + (i - 36); + pre += static_cast<uint8_t>('a' + (i - 36)); break; case 62: pre += '+'; 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 { }) diff --git a/tests/unit/libutil-support/tests/terminal-code-eater.cc b/tests/unit/libutil-support/tests/terminal-code-eater.cc index ad05ed1f6..6e108009a 100644 --- a/tests/unit/libutil-support/tests/terminal-code-eater.cc +++ b/tests/unit/libutil-support/tests/terminal-code-eater.cc @@ -26,6 +26,7 @@ void TerminalCodeEater::feed(char c, std::function<void(char)> on_char) // Just eat \r, since it is part of clearing a line case '\r': return; + default: break; } if constexpr (DEBUG_EATER) { std::cerr << "eater uneat" << MaybeHexEscapedChar{c} << "\n"; |