fix clang-tidy warnings

- Add NOLINT for intentional global mutable state
- Simplify boolean return in parse_posix_tz
- Add USE_TIME_TIMEZONE define for tests
- Add NOLINT for Google Test SetUp/TearDown methods
This commit is contained in:
J. Nick Koston
2026-01-30 02:51:20 -06:00
parent b5e073bf7f
commit dcd0f53027
2 changed files with 7 additions and 5 deletions

View File

@@ -1,6 +1,9 @@
// Tests for the POSIX TZ parser and ESPTime::strptime implementations
// These custom parsers avoid pulling in scanf (~9.8KB on ESP32-IDF).
// Enable USE_TIME_TIMEZONE for tests
#define USE_TIME_TIMEZONE
#include <gtest/gtest.h>
#include <cstdlib>
#include <ctime>
@@ -752,6 +755,7 @@ TEST(PosixTzParser, EpochToLocalDstTransition) {
class LibcVerificationTest : public ::testing::TestWithParam<std::tuple<const char *, time_t>> {
protected:
// NOLINTNEXTLINE(readability-identifier-naming) - Google Test requires this name
void SetUp() override {
// Save current TZ
const char *current_tz = getenv("TZ");
@@ -759,6 +763,7 @@ class LibcVerificationTest : public ::testing::TestWithParam<std::tuple<const ch
had_tz_ = current_tz != nullptr;
}
// NOLINTNEXTLINE(readability-identifier-naming) - Google Test requires this name
void TearDown() override {
// Restore TZ
if (had_tz_) {