diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1fee693..476afde 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,10 +7,7 @@ repos: - id: check-case-conflict - id: check-merge-conflict - id: check-yaml - additional_dependencies: [ ruamel.yaml>=0.15 ] - - id: debug-statements - id: end-of-file-fixer - exclude: "tests/fixture/no_newline_file.txt" - id: trailing-whitespace - repo: https://github.com/pre-commit/mirrors-clang-format rev: v21.1.2 @@ -21,23 +18,6 @@ repos: rev: 1.4.3 hooks: - id: cmakelint - - repo: https://github.com/asottile/reorder-python-imports - rev: v3.16.0 - hooks: - - id: reorder-python-imports - args: [--py310-plus] - - repo: https://github.com/asottile/add-trailing-comma - rev: v4.0.0 - hooks: - - id: add-trailing-comma - - repo: https://github.com/PyCQA/flake8 - rev: 7.3.0 - hooks: - - id: flake8 - - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.18.2 - hooks: - - id: mypy - repo: https://github.com/rhysd/actionlint rev: v1.7.8 hooks: diff --git a/src/main.cpp b/src/main.cpp index 0e83379..5b15020 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,8 +10,8 @@ auto main() -> int { return Willow::runTests( { {"test_runTests", test_runTests}, - {"test_alert", test_alert}, {"test_toString", test_toString}, + {"test_Test_alert", test_Test_alert}, {"test_Test_Operator()", test_Test_Operator}, {"PreCommitReporter::print", TestPreCommitReporter::test_print}, {"PreCommitReporter::cleanup", TestPreCommitReporter::test_cleanup}, diff --git a/src/tests/test_test.h b/src/tests/test_test.h index 62e2642..429b7ed 100644 --- a/src/tests/test_test.h +++ b/src/tests/test_test.h @@ -28,3 +28,13 @@ constexpr auto test_Test_Operator([[maybe_unused]] Willow::Test* test) -> int { return !(t.retcode == 42); } + +constexpr auto test_Test_alert([[maybe_unused]] Willow::Test* test) -> int { + Willow::Test t {}; + t.alert("fail"); + + if (t.msg.has_value() && t.msg.value() == "fail") { + return 0; + } + return 1; +} diff --git a/src/tests/test_willow.h b/src/tests/test_willow.h index 1ff04a4..5e3fdaf 100644 --- a/src/tests/test_willow.h +++ b/src/tests/test_willow.h @@ -20,13 +20,3 @@ constexpr auto test_runTests([[maybe_unused]] Willow::Test* test) -> int { return !(ret == 1); } - -constexpr auto test_alert([[maybe_unused]] Willow::Test* test) -> int { - Willow::Test t {}; - Willow::alert(&t, "fail"); - - if (t.msg.has_value() && t.msg.value() == "fail") { - return 0; - } - return 1; -} diff --git a/src/willow/test.h b/src/willow/test.h index bb8fa15..7023e30 100644 --- a/src/willow/test.h +++ b/src/willow/test.h @@ -42,6 +42,8 @@ namespace Willow { : name {given_name}, fn {f}, status {st} {} auto operator()() -> void { retcode = fn(this); } + + constexpr auto alert(std::string message) -> void { msg = message; } }; }; // namespace Willow diff --git a/src/willow/willow.h b/src/willow/willow.h index 452894c..787ec96 100644 --- a/src/willow/willow.h +++ b/src/willow/willow.h @@ -30,10 +30,6 @@ namespace Willow { })); } - constexpr auto alert(Test* test, std::string message) -> void { - test->msg = message; - } - } // namespace Willow #endif // WILLOW_H