From: Bartosz Golaszewski Date: Tue, 11 Apr 2023 11:53:32 +0000 (+0200) Subject: tests: fix version regex treewide X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7936f5021842d50d8131164cf26eb1a702521c25;p=qemu-gpiodev%2Flibgpiod.git tests: fix version regex treewide The square bracket is in the wrong place which makes the regex not match version strings of the form: x.y.z. Fix the pattern in core and bindings tests. Signed-off-by: Bartosz Golaszewski --- diff --git a/bindings/cxx/tests/tests-misc.cpp b/bindings/cxx/tests/tests-misc.cpp index 55f2232..200fd35 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("^[0-9][1-9]?\\.[0-9][1-9]?([\\.0-9]?|\\-devel|\\-rc[0-9])$")); + regex_matcher("^[0-9][1-9]?\\.[0-9][1-9]?(\\.[0-9]?|\\-devel|\\-rc[0-9])$")); } } diff --git a/bindings/python/tests/tests_module.py b/bindings/python/tests/tests_module.py index cfb4b34..d4c90e2 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 = "^[0-9][1-9]?\\.[0-9][1-9]?((\\.[0-9])?|\\-devel|\\-rc[0-9])$" + VERSION_PATTERN = "^[0-9][1-9]?\\.[0-9][1-9]?(\\.[0-9]?|\\-devel|\\-rc[0-9])$" 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 fa8deca..a4c35fb 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 = "^[0-9][1-9]?\\.[0-9][1-9]?([\\.0-9]?|\\-devel|\\-rc[0-9])$"; + static const gchar *const pattern = "^[0-9][1-9]?\\.[0-9][1-9]?(\\.[0-9]?|\\-devel|\\-rc[0-9])$"; g_autoptr(GError) err = NULL; g_autoptr(GRegex) regex = NULL;