tests: fix version parsing (again)
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 3 Nov 2023 16:17:00 +0000 (17:17 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 3 Nov 2023 16:17:34 +0000 (17:17 +0100)
This time we missed the fact that the last part is optional. Fix it
treewide.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
bindings/cxx/tests/tests-misc.cpp
bindings/python/tests/tests_module.py
tests/tests-misc.c

index 1fa300a4454ce5df670600315b182f30e3e50219..f06dc3900822ddcecdadc066cab0df1fd251da99 100644 (file)
@@ -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+)?$"));
        }
 }
 
index edc0647505878d4a451c8681ecc7e00e7a3fe767..c6f07a618b2c19e6afae9b1bf48747b086c8919a 100644 (file)
@@ -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)
index 1e30ad25d62119626057344a9cbd29e22d8609f4..240dd02487bfc4bb652f1cedf138fff1da7ac642 100644 (file)
@@ -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;