From f054a7099dffa3f5176050217c9bfb44fdc426a6 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Fri, 3 Nov 2023 17:17:00 +0100 Subject: [PATCH] tests: fix version parsing (again) This time we missed the fact that the last part is optional. Fix it treewide. Signed-off-by: Bartosz Golaszewski --- bindings/cxx/tests/tests-misc.cpp | 2 +- bindings/python/tests/tests_module.py | 2 +- tests/tests-misc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/cxx/tests/tests-misc.cpp b/bindings/cxx/tests/tests-misc.cpp index 1fa300a..f06dc39 100644 --- a/bindings/cxx/tests/tests-misc.cpp +++ b/bindings/cxx/tests/tests-misc.cpp @@ -71,7 +71,7 @@ TEST_CASE("api_version() returns a valid API version", "[misc]") SECTION("check api_version() format") { REQUIRE_THAT(::gpiod::api_version(), - regex_matcher("^\\d+\\.\\d+(\\.\\d+|\\-devel|\\-rc\\d+)$")); + regex_matcher("^\\d+\\.\\d+(\\.\\d+|\\-devel|\\-rc\\d+)?$")); } } diff --git a/bindings/python/tests/tests_module.py b/bindings/python/tests/tests_module.py index edc0647..c6f07a6 100644 --- a/bindings/python/tests/tests_module.py +++ b/bindings/python/tests/tests_module.py @@ -51,7 +51,7 @@ class IsGPIOChip(TestCase): class VersionString(TestCase): - VERSION_PATTERN = "^\\d+\\.\\d+(\\.\\d+|\\-devel|\\-rc\\d+)$" + VERSION_PATTERN = "^\\d+\\.\\d+(\\.\\d+|\\-devel|\\-rc\\d+)?$" def test_api_version_string(self): self.assertRegex(gpiod.api_version, VersionString.VERSION_PATTERN) diff --git a/tests/tests-misc.c b/tests/tests-misc.c index 1e30ad2..240dd02 100644 --- a/tests/tests-misc.c +++ b/tests/tests-misc.c @@ -67,7 +67,7 @@ GPIOD_TEST_CASE(is_gpiochip_null_path) GPIOD_TEST_CASE(version_string) { - static const gchar *const pattern = "^\\d+\\.\\d+(\\.\\d+|\\-devel|\\-rc\\d+)$"; + static const gchar *const pattern = "^\\d+\\.\\d+(\\.\\d+|\\-devel|\\-rc\\d+)?$"; g_autoptr(GError) err = NULL; g_autoptr(GRegex) regex = NULL; -- 2.30.2