From 613c718cf32ddc47f15563244f0c5cdeb110a974 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 12:48:09 +0100 Subject: [PATCH 01/39] updated CI --- .github/workflows/main.yml | 5 +++++ azure-pipelines.yml | 1 + 2 files changed, 6 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5677b97..0fcf83b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,6 +32,9 @@ jobs: cmake --build ./build_gcc -j12 - name: unittests run: ./build_gcc/bin/unittests + - name: example + run: ./build_gcc/bin/example ./examples + build-clang: runs-on: ubuntu-latest @@ -51,4 +54,6 @@ jobs: cmake --build ./build_clang -j12 - name: unittests run: ./build_clang/bin/unittests + - name: examples + run: ./build_clang/bin/example ./examples diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bae18d5..9497153 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,4 +25,5 @@ jobs: cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" cmake --build ./build --config Release -j6 .\build\bin\Release\unittests.exe + .\build\bin\Release\example.exe .\examples displayName: 'Win Release Build' From f0e25459b50580d73fb59bb2529d4da3ad9c75b7 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 12:48:41 +0100 Subject: [PATCH 02/39] added default to_string --- src/step.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/step.cpp b/src/step.cpp index 72caf63..87c6a29 100644 --- a/src/step.cpp +++ b/src/step.cpp @@ -50,6 +50,8 @@ std::string to_string(step::type type) return "Then"; case step::type::step: return "Step"; + default: + return "..."; } } } // namespace cuke::internal From dde892b7fe4b09c5bc9934842d5a30e2ea54d7a0 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 13:05:17 +0100 Subject: [PATCH 03/39] changed defines --- src/defines.hpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/defines.hpp b/src/defines.hpp index 1fc3488..d148db1 100644 --- a/src/defines.hpp +++ b/src/defines.hpp @@ -53,7 +53,11 @@ [[maybe_unused]] cuke::value_array::const_iterator __cuke__values__, \ [[maybe_unused]] std::size_t __cuke__values__count__) -#define GET_MACRO(_1, _2, _3, _4, NAME, ...) NAME +#define COUNT_ARGS_IMPL(_1, _2, _3, _4, COUNT, ...) COUNT +#define COUNT_ARGS(...) COUNT_ARGS_IMPL(__VA_ARGS__, 4, 3, 2, 1) + +#define SELECT_MACRO(NAME, COUNT) NAME##COUNT +#define EXPAND_MACRO(NAME, COUNT) SELECT_MACRO(NAME, COUNT) /** * @def CUSTOM_PARAMETER(function_name, key, pattern, opt: description) * @brief Creates a custom expression type to use in steps. @@ -67,15 +71,13 @@ * @param description Optional description: This description is only printed as * is in the steps-catalog. */ -#define CUSTOM_PARAMETER(...) \ - GET_MACRO(__VA_ARGS__, _CUSTOM_PARAMETER_WITH_DESC, \ - _CUSTOM_PARAMETER_NO_DESC) \ - (__VA_ARGS__) +#define CUSTOM_PARAMETER(...) \ + EXPAND_MACRO(_CUSTOM_PARAMETER_IMPL, COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__) -#define _CUSTOM_PARAMETER_WITH_DESC(function_name, key, pattern, description) \ +#define _CUSTOM_PARAMETER_IMPL4(function_name, key, pattern, description) \ _CUSTOM_PARAMETER_IMPL(function_name, key, pattern, description) -#define _CUSTOM_PARAMETER_NO_DESC(function_name, key, pattern) \ +#define _CUSTOM_PARAMETER_IMPL3(function_name, key, pattern) \ _CUSTOM_PARAMETER_IMPL(function_name, key, pattern, "No description found") /** From d20f8c4996dcd8bd1e728bb1b6b20b8181b5073c Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 13:17:45 +0100 Subject: [PATCH 04/39] updated defines --- examples/step_definition.cpp | 2 +- src/defines.hpp | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/examples/step_definition.cpp b/examples/step_definition.cpp index 95d2bfb..af3a2b2 100644 --- a/examples/step_definition.cpp +++ b/examples/step_definition.cpp @@ -36,7 +36,7 @@ CUSTOM_PARAMETER( return date_range{begin, end}; } -CUSTOM_PARAMETER(custom_event, "{event}", R"('(.*?)')") +CUSTOM_PARAMETER(custom_event, "{event}", R"('(.*?)')", "a custom event") { return CUKE_PARAM_ARG(1).to_string(); } diff --git a/src/defines.hpp b/src/defines.hpp index d148db1..1ee6b39 100644 --- a/src/defines.hpp +++ b/src/defines.hpp @@ -53,11 +53,6 @@ [[maybe_unused]] cuke::value_array::const_iterator __cuke__values__, \ [[maybe_unused]] std::size_t __cuke__values__count__) -#define COUNT_ARGS_IMPL(_1, _2, _3, _4, COUNT, ...) COUNT -#define COUNT_ARGS(...) COUNT_ARGS_IMPL(__VA_ARGS__, 4, 3, 2, 1) - -#define SELECT_MACRO(NAME, COUNT) NAME##COUNT -#define EXPAND_MACRO(NAME, COUNT) SELECT_MACRO(NAME, COUNT) /** * @def CUSTOM_PARAMETER(function_name, key, pattern, opt: description) * @brief Creates a custom expression type to use in steps. @@ -71,15 +66,9 @@ * @param description Optional description: This description is only printed as * is in the steps-catalog. */ -#define CUSTOM_PARAMETER(...) \ - EXPAND_MACRO(_CUSTOM_PARAMETER_IMPL, COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__) - -#define _CUSTOM_PARAMETER_IMPL4(function_name, key, pattern, description) \ +#define CUSTOM_PARAMETER(function_name, key, pattern, description) \ _CUSTOM_PARAMETER_IMPL(function_name, key, pattern, description) -#define _CUSTOM_PARAMETER_IMPL3(function_name, key, pattern) \ - _CUSTOM_PARAMETER_IMPL(function_name, key, pattern, "No description found") - /** * @def CUKE_PARAM_ARG(index) * @brief Access capture groups from a custom expression in its callback. From 0d8b6e02387a271f3c8280a87b4f4908832bcd81 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 13:30:11 +0100 Subject: [PATCH 05/39] added implicit string conversion --- src/value.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/value.hpp b/src/value.hpp index 28f598f..a34ec95 100644 --- a/src/value.hpp +++ b/src/value.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -33,6 +34,11 @@ class value ~value() = default; + operator std::string() const { return this->to_string(); } + operator std::string_view() const + { + return std::string_view{this->to_string().data()}; + } template operator T() const { @@ -112,7 +118,8 @@ class value * @brief Converts the underlying value to a string. If not possible, this * function throws a std::runtime_error */ - [[nodiscard]] std::string to_string() const { return m_value; } + [[nodiscard]] std::string to_string() { return m_value; } + [[nodiscard]] const std::string& to_string() const { return m_value; } private: std::string m_value; From 4a9178907745a97fd419a80182c132a7382a23a1 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 13:35:49 +0100 Subject: [PATCH 06/39] updated README --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6841337..40e1b3a 100644 --- a/README.md +++ b/README.md @@ -566,12 +566,12 @@ If you want to execute all feature files in a directory (and subdirectory), just CWT-Cucumber supports custom parameter types. This means that we can define custom expressions in our steps to introduce custom types (so to speak) and make the step definition more understandable. -In general: A custom parameter type is an individually defined type that we can use in the step definition. So we give the parameter a function name (as in a step), give the custom type a meaningful name, a description and a regex pattern. Then we implement a callback to consume the capture groups from the regex pattern. Here we use `CUSTOM_PARAMETER(function-name, "{here goes your type}", "regex pattern", "optional: description")`. +In general: A custom parameter type is an individually defined type that we can use in the step definition. So we give the parameter a function name (as in a step), give the custom type a meaningful name, a description and a regex pattern. Then we implement a callback to consume the capture groups from the regex pattern. Here we use `CUSTOM_PARAMETER(function-name, "{here goes your type}", "regex pattern", "description")`. - Function-name: A defined function name (same as in steps) - Custom-Type: Define the type you want, **with curly braces** as string - Regex-Pattern: The regex pattern to match the step, you can use raw string literals, which makes it easier to write regex pattern (see below) -- **Optional** description: A string value to give a meaning full description. This will be printed to the catalog and has no effect on the scenarios. +- Description: A string value to give a meaning full description. This will be printed to the catalog and has no effect on the scenarios. In order to access the capture groups, use `CUKE_PARAM_ARG(index)` where the index starts at 1 from left to right. @@ -585,7 +585,7 @@ Find all implementations in `examples/step_definition.cpp` and the examples in ` Lets define a type `{pair of integers}`, which will create a `std::pair`: ```cpp -CUSTOM_PARAMETER(custom, "{pair of integers}", R"(var1=(\d+), var2=(\d+))") +CUSTOM_PARAMETER(custom, "{pair of integers}", R"(var1=(\d+), var2=(\d+))", "a pair of integers") { int var1 = CUKE_PARAM_ARG(1); int var2 = CUKE_PARAM_ARG(2); @@ -620,7 +620,7 @@ A more complex example is defined below. We want to parse an event (which is rep `{event}` is fairly easy here: ```cpp -CUSTOM_PARAMETER(custom_event, "{event}", R"('(.*?)')") +CUSTOM_PARAMETER(custom_event, "{event}", R"('(.*?)')", "a custom event") { return CUKE_PARAM_ARG(1).to_string(); } From 413f9452b35efae3e74f33e919f637523aea409e Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 14:14:42 +0100 Subject: [PATCH 07/39] updated implicit conversion --- src/value.hpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/value.hpp b/src/value.hpp index a34ec95..b392235 100644 --- a/src/value.hpp +++ b/src/value.hpp @@ -34,11 +34,8 @@ class value ~value() = default; - operator std::string() const { return this->to_string(); } - operator std::string_view() const - { - return std::string_view{this->to_string().data()}; - } + operator std::string() const { return m_value; } + template operator T() const { From 31c6e65db401f04b11f44e3d637586aa8810c58c Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 14:29:54 +0100 Subject: [PATCH 08/39] updated implicit conversion --- src/value.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/value.hpp b/src/value.hpp index b392235..35e7db0 100644 --- a/src/value.hpp +++ b/src/value.hpp @@ -36,7 +36,8 @@ class value operator std::string() const { return m_value; } - template + template >> operator T() const { return this->as(); From c6b488648fe9680071217ec67fd067b6e15182f8 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 14:44:38 +0100 Subject: [PATCH 09/39] updated implicit conversion --- src/value.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/value.hpp b/src/value.hpp index 35e7db0..3bb7737 100644 --- a/src/value.hpp +++ b/src/value.hpp @@ -34,7 +34,7 @@ class value ~value() = default; - operator std::string() const { return m_value; } + explicit operator std::string() const { return m_value; } template >> From c15e6f1ea0cf6d06d5a86e010a3e30467678fd2e Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 14:57:35 +0100 Subject: [PATCH 10/39] updated implicit conversion --- src/value.hpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/value.hpp b/src/value.hpp index 3bb7737..a6990ce 100644 --- a/src/value.hpp +++ b/src/value.hpp @@ -34,15 +34,18 @@ class value ~value() = default; - explicit operator std::string() const { return m_value; } - - template >> + template operator T() const { - return this->as(); + if constexpr (std::is_convertible_v) + { + return m_value; + } + else + { + return this->as(); + } } - /** * @brief Checks if the cuke::value is nil * @return True if it is a nil type, else its false From 8a0e8a9c665cb4e00cb38640e5ae8a5ae52ee4d5 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 15:12:09 +0100 Subject: [PATCH 11/39] updated implicit conversion --- src/value.hpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/value.hpp b/src/value.hpp index a6990ce..c6068ad 100644 --- a/src/value.hpp +++ b/src/value.hpp @@ -34,17 +34,13 @@ class value ~value() = default; + operator std::string() const { return std::string(m_value); } + operator const std::string&() const { return m_value; } + template operator T() const { - if constexpr (std::is_convertible_v) - { - return m_value; - } - else - { - return this->as(); - } + return this->as(); } /** * @brief Checks if the cuke::value is nil From 6e237a78a52392be6b54b170ef6a916524a04495 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 15:23:16 +0100 Subject: [PATCH 12/39] updated implicit conversion --- src/value.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/value.hpp b/src/value.hpp index c6068ad..a21b6c5 100644 --- a/src/value.hpp +++ b/src/value.hpp @@ -34,7 +34,6 @@ class value ~value() = default; - operator std::string() const { return std::string(m_value); } operator const std::string&() const { return m_value; } template From 2311a3c52a27e6205670271abbd5c55cc36bf48b Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 15:35:35 +0100 Subject: [PATCH 13/39] updated azure pipeline --- azure-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9497153..4e99ccf 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,5 +25,6 @@ jobs: cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" cmake --build ./build --config Release -j6 .\build\bin\Release\unittests.exe - .\build\bin\Release\example.exe .\examples + .\build\bin\Release\example.exe --steps-catalog + .\build\bin\Release\example.exe examples displayName: 'Win Release Build' From 8f85c8350a2c4eef021a35cedf8bcc2d5cf87f10 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 15:48:03 +0100 Subject: [PATCH 14/39] updated azure pipeline --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4e99ccf..3c48ef0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,6 +24,8 @@ jobs: conan install . -of build --build missing cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" cmake --build ./build --config Release -j6 + dir + dir .\build .\build\bin\Release\unittests.exe .\build\bin\Release\example.exe --steps-catalog .\build\bin\Release\example.exe examples From 4335af462cc48d491fa86e01d8107ac619919d7c Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 15:59:28 +0100 Subject: [PATCH 15/39] updated azure pipeline --- azure-pipelines.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3c48ef0..ac9de7d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,8 +24,7 @@ jobs: conan install . -of build --build missing cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" cmake --build ./build --config Release -j6 - dir - dir .\build + dir .\build\bin\Release .\build\bin\Release\unittests.exe .\build\bin\Release\example.exe --steps-catalog .\build\bin\Release\example.exe examples From af1b8f5eb829cd72b6fe87a95e1146fd865a9cee Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 16:10:42 +0100 Subject: [PATCH 16/39] updated azure pipeline --- azure-pipelines.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ac9de7d..e2e5deb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,8 +24,10 @@ jobs: conan install . -of build --build missing cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" cmake --build ./build --config Release -j6 - dir .\build\bin\Release + displayName: 'Win Release Build' + - script: | .\build\bin\Release\unittests.exe - .\build\bin\Release\example.exe --steps-catalog + displayName: 'Run Unittests' + - script: | .\build\bin\Release\example.exe examples - displayName: 'Win Release Build' + displayName: 'Run example' From 07579230f14135e702afc7e75fed0d1d5a126675 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 16:27:14 +0100 Subject: [PATCH 17/39] updated azure pipeline --- azure-pipelines.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e2e5deb..ee90280 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,5 +29,7 @@ jobs: .\build\bin\Release\unittests.exe displayName: 'Run Unittests' - script: | - .\build\bin\Release\example.exe examples + dir .\build\bin\Release + .\build\bin\Release\example.exe + .\build\bin\Release\example.exe ./examples/features displayName: 'Run example' From 545664f58a85cc977ccd1cb232a117a94d9c34e1 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 16:31:10 +0100 Subject: [PATCH 18/39] added windows pipeline --- .github/workflows/main.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0fcf83b..8331976 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,3 +57,38 @@ jobs: - name: examples run: ./build_clang/bin/example ./examples + WindowsBuild: + runs-on: windows-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Install Python, CMake, and Conan + run: | + choco install python3 -y + py.exe -m pip install cmake + py.exe -m pip install conan + + - name: Initialize Conan + run: | + set PATH=%PATH%;C:\hostedtoolcache\windows\Python\3.12.7\x64\Scripts + conan --version # Check Conan version + conan profile detect + powershell -Command "(gc C:\Users\RunnerAdmin\.conan2\profiles\default) -replace 'compiler.cppstd=14', 'compiler.cppstd=20' | Out-File -encoding ASCII C:\Users\RunnerAdmin\.conan2\profiles\default" + powershell -Command "(gc C:\Users\RunnerAdmin\.conan2\profiles\default) -replace 'compiler.runtime=dynamic', 'compiler.runtime=static' | Out-File -encoding ASCII C:\Users\RunnerAdmin\.conan2\profiles\default" + + - name: Conan Install and Build + run: | + set PATH=%PATH%;C:\hostedtoolcache\windows\Python\3.12.7\x64\Scripts + conan install . -of build --build missing + cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" + cmake --build ./build --config Release -j6 + + - name: Run Unittests + run: .\build\bin\Release\unittests.exe + + - name: Run Example + run: | + dir .\build\bin\Release + .\build\bin\Release\example.exe + .\build\bin\Release\example.exe ./examples/features From 78d19c3eae5b043e0e8cda295a3c99eba2b83d78 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 16:43:58 +0100 Subject: [PATCH 19/39] update CI --- .github/workflows/main.yml | 54 ++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8331976..abc199e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,37 +58,45 @@ jobs: run: ./build_clang/bin/example ./examples WindowsBuild: - runs-on: windows-latest + + runs-on: windows-latest steps: - - name: Checkout Repository - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v2 - - name: Install Python, CMake, and Conan + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.12' + + - name: Install pip tools run: | - choco install python3 -y - py.exe -m pip install cmake - py.exe -m pip install conan + python -m pip install --upgrade pip + pip install cmake conan - name: Initialize Conan run: | set PATH=%PATH%;C:\hostedtoolcache\windows\Python\3.12.7\x64\Scripts conan --version # Check Conan version conan profile detect - powershell -Command "(gc C:\Users\RunnerAdmin\.conan2\profiles\default) -replace 'compiler.cppstd=14', 'compiler.cppstd=20' | Out-File -encoding ASCII C:\Users\RunnerAdmin\.conan2\profiles\default" - powershell -Command "(gc C:\Users\RunnerAdmin\.conan2\profiles\default) -replace 'compiler.runtime=dynamic', 'compiler.runtime=static' | Out-File -encoding ASCII C:\Users\RunnerAdmin\.conan2\profiles\default" + conan profile show + - - name: Conan Install and Build - run: | - set PATH=%PATH%;C:\hostedtoolcache\windows\Python\3.12.7\x64\Scripts - conan install . -of build --build missing - cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" - cmake --build ./build --config Release -j6 - - - name: Run Unittests - run: .\build\bin\Release\unittests.exe + # powershell -Command "(gc C:\Users\RunnerAdmin\.conan2\profiles\default) -replace 'compiler.cppstd=14', 'compiler.cppstd=20' | Out-File -encoding ASCII C:\Users\RunnerAdmin\.conan2\profiles\default" + # powershell -Command "(gc C:\Users\RunnerAdmin\.conan2\profiles\default) -replace 'compiler.runtime=dynamic', 'compiler.runtime=static' | Out-File -encoding ASCII C:\Users\RunnerAdmin\.conan2\profiles\default" - - name: Run Example - run: | - dir .\build\bin\Release - .\build\bin\Release\example.exe - .\build\bin\Release\example.exe ./examples/features + # - name: Conan Install and Build + # run: | + # set PATH=%PATH%;C:\hostedtoolcache\windows\Python\3.12.7\x64\Scripts + # conan install . -of build --build missing + # cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" + # cmake --build ./build --config Release -j6 + # + # - name: Run Unittests + # run: .\build\bin\Release\unittests.exe + # + # - name: Run Example + # run: | + # dir .\build\bin\Release + # .\build\bin\Release\example.exe + # .\build\bin\Release\example.exe ./examples/features From 3034632ee6c7dab6ceaf74dc9d05090ff2fe3ac1 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 16:48:59 +0100 Subject: [PATCH 20/39] update CI --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index abc199e..1be7cad 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -76,7 +76,6 @@ jobs: - name: Initialize Conan run: | - set PATH=%PATH%;C:\hostedtoolcache\windows\Python\3.12.7\x64\Scripts conan --version # Check Conan version conan profile detect conan profile show From 62fd85153b7a54cd5cda4754b9598552d6a20ae8 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 19:02:42 +0100 Subject: [PATCH 21/39] updated CI --- .github/workflows/main.yml | 32 ++++++++++++++++---------------- azure-pipelines.yml | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1be7cad..f992a49 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -78,24 +78,24 @@ jobs: run: | conan --version # Check Conan version conan profile detect - conan profile show + powershell -Command "(gc C:\Users\runneradmin\.conan2\profiles\default) -replace 'compiler.cppstd=14', 'compiler.cppstd=20' | Out-File -encoding ASCII C:\Users\runneradmin\.conan2\profiles\default" + powershell -Command "(gc C:\Users\runneradmin\.conan2\profiles\default) -replace 'compiler.runtime=dynamic', 'compiler.runtime=static' | Out-File -encoding ASCII C:\Users\runneradmin\.conan2\profiles\default" # powershell -Command "(gc C:\Users\RunnerAdmin\.conan2\profiles\default) -replace 'compiler.cppstd=14', 'compiler.cppstd=20' | Out-File -encoding ASCII C:\Users\RunnerAdmin\.conan2\profiles\default" # powershell -Command "(gc C:\Users\RunnerAdmin\.conan2\profiles\default) -replace 'compiler.runtime=dynamic', 'compiler.runtime=static' | Out-File -encoding ASCII C:\Users\RunnerAdmin\.conan2\profiles\default" - - # - name: Conan Install and Build - # run: | # set PATH=%PATH%;C:\hostedtoolcache\windows\Python\3.12.7\x64\Scripts - # conan install . -of build --build missing - # cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" - # cmake --build ./build --config Release -j6 - # - # - name: Run Unittests - # run: .\build\bin\Release\unittests.exe - # - # - name: Run Example - # run: | - # dir .\build\bin\Release - # .\build\bin\Release\example.exe - # .\build\bin\Release\example.exe ./examples/features + + - name: Conan Install and Build + run: | + conan install . -of build --build missing + cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" + cmake --build ./build --config Release -j6 + + - name: Run Unittests + run: .\build\bin\Release\unittests.exe + + - name: Run Example + run: | + .\build\bin\Release\example.exe + .\build\bin\Release\example.exe ./examples/features diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ee90280..451eb4b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,5 +1,5 @@ trigger: -- '*' +- 'main' jobs: - job: WindowsBuild From 0859262c9874401debf45821b6f1a8021f46ac77 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 19:09:28 +0100 Subject: [PATCH 22/39] updated pipelines --- .github/workflows/main.yml | 40 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f992a49..85d16f4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ on: branches: [ "**" ] jobs: - build-gcc: + gcc: runs-on: ubuntu-latest container: those90/ci-image:1.0 env: @@ -22,13 +22,7 @@ jobs: - name: build run: | conan install . -of ./build_gcc --build missing - cmake -S . -B ./build_gcc -DCMAKE_TOOLCHAIN_FILE=./build_gcc/conan_toolchain.cmake - ls -la ./gtest - ls -la ./gtest/test_files - cat ./gtest/test_paths.hpp - echo "****" - pwd - echo "****" + cmake -S . -B ./build_gcc -DCMAKE_TOOLCHAIN_FILE=./build_gcc/conan_toolchain.cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc cmake --build ./build_gcc -j12 - name: unittests run: ./build_gcc/bin/unittests @@ -36,7 +30,7 @@ jobs: run: ./build_gcc/bin/example ./examples - build-clang: + Clang: runs-on: ubuntu-latest container: those90/ci-image:1.0 env: @@ -48,54 +42,40 @@ jobs: run: | conan install . -of ./build_clang --build missing -pr clang cmake -S . -B ./build_clang -DCMAKE_TOOLCHAIN_FILE=./build_clang/conan_toolchain.cmake -DCMAKE_CXX_COMPILER=clang++-17 -DCMAKE_C_COMPILER=clang-17 - ls -la ./gtest - ls -la ./gtest/test_files - cat ./gtest/test_paths.hpp cmake --build ./build_clang -j12 - name: unittests run: ./build_clang/bin/unittests - name: examples run: ./build_clang/bin/example ./examples - WindowsBuild: - + MSVC: runs-on: windows-latest steps: - name: Checkout code uses: actions/checkout@v2 - - name: Set up Python uses: actions/setup-python@v2 with: python-version: '3.12' - - name: Install pip tools run: | python -m pip install --upgrade pip pip install cmake conan - - - name: Initialize Conan + - name: Conan run: | conan --version # Check Conan version conan profile detect powershell -Command "(gc C:\Users\runneradmin\.conan2\profiles\default) -replace 'compiler.cppstd=14', 'compiler.cppstd=20' | Out-File -encoding ASCII C:\Users\runneradmin\.conan2\profiles\default" powershell -Command "(gc C:\Users\runneradmin\.conan2\profiles\default) -replace 'compiler.runtime=dynamic', 'compiler.runtime=static' | Out-File -encoding ASCII C:\Users\runneradmin\.conan2\profiles\default" - - - # powershell -Command "(gc C:\Users\RunnerAdmin\.conan2\profiles\default) -replace 'compiler.cppstd=14', 'compiler.cppstd=20' | Out-File -encoding ASCII C:\Users\RunnerAdmin\.conan2\profiles\default" - # powershell -Command "(gc C:\Users\RunnerAdmin\.conan2\profiles\default) -replace 'compiler.runtime=dynamic', 'compiler.runtime=static' | Out-File -encoding ASCII C:\Users\RunnerAdmin\.conan2\profiles\default" - # set PATH=%PATH%;C:\hostedtoolcache\windows\Python\3.12.7\x64\Scripts - - - name: Conan Install and Build + - name: Build run: | conan install . -of build --build missing cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" cmake --build ./build --config Release -j6 - - - name: Run Unittests + - name: Unittests run: .\build\bin\Release\unittests.exe - - - name: Run Example + - name: Example run: | + dir + dir .\build\bin\Release .\build\bin\Release\example.exe - .\build\bin\Release\example.exe ./examples/features From cd9eb9cbd40caa1d510d2d3d36f0a8cc09490367 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 19:14:25 +0100 Subject: [PATCH 23/39] updated string initialization --- azure-pipelines.yml | 70 ++++++++++++++++++------------------ examples/step_definition.cpp | 2 +- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 451eb4b..9bccf63 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,35 +1,35 @@ -trigger: -- 'main' - -jobs: - - job: WindowsBuild - pool: - vmImage: 'windows-latest' - steps: - - script: | - choco install python3 -y - py.exe -m pip install cmake - py.exe -m pip install conan - displayName: Install CMake, Conan - # for now it does its job ... i know the hardcoded paths are ugly... - - script: | - set PATH=%PATH%;C:\hostedtoolcache\windows\Python\3.12.7\x64\Scripts - conan --version # Now you can use Conan - conan profile detect - powershell -Command "(gc C:\Users\VssAdministrator\.conan2\profiles\default) -replace 'compiler.cppstd=14', 'compiler.cppstd=20' | Out-File -encoding ASCII C:\Users\VssAdministrator\.conan2\profiles\default" - powershell -Command "(gc C:\Users\VssAdministrator\.conan2\profiles\default) -replace 'compiler.runtime=dynamic', 'compiler.runtime=static' | Out-File -encoding ASCII C:\Users\VssAdministrator\.conan2\profiles\default" - displayName: 'Init Conan' - - script: | - set PATH=%PATH%;C:\hostedtoolcache\windows\Python\3.12.7\x64\Scripts - conan install . -of build --build missing - cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" - cmake --build ./build --config Release -j6 - displayName: 'Win Release Build' - - script: | - .\build\bin\Release\unittests.exe - displayName: 'Run Unittests' - - script: | - dir .\build\bin\Release - .\build\bin\Release\example.exe - .\build\bin\Release\example.exe ./examples/features - displayName: 'Run example' +# trigger: +# - 'main' +# +# jobs: +# - job: WindowsBuild +# pool: +# vmImage: 'windows-latest' +# steps: +# - script: | +# choco install python3 -y +# py.exe -m pip install cmake +# py.exe -m pip install conan +# displayName: Install CMake, Conan +# # for now it does its job ... i know the hardcoded paths are ugly... +# - script: | +# set PATH=%PATH%;C:\hostedtoolcache\windows\Python\3.12.7\x64\Scripts +# conan --version # Now you can use Conan +# conan profile detect +# powershell -Command "(gc C:\Users\VssAdministrator\.conan2\profiles\default) -replace 'compiler.cppstd=14', 'compiler.cppstd=20' | Out-File -encoding ASCII C:\Users\VssAdministrator\.conan2\profiles\default" +# powershell -Command "(gc C:\Users\VssAdministrator\.conan2\profiles\default) -replace 'compiler.runtime=dynamic', 'compiler.runtime=static' | Out-File -encoding ASCII C:\Users\VssAdministrator\.conan2\profiles\default" +# displayName: 'Init Conan' +# - script: | +# set PATH=%PATH%;C:\hostedtoolcache\windows\Python\3.12.7\x64\Scripts +# conan install . -of build --build missing +# cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" +# cmake --build ./build --config Release -j6 +# displayName: 'Win Release Build' +# - script: | +# .\build\bin\Release\unittests.exe +# displayName: 'Run Unittests' +# - script: | +# dir .\build\bin\Release +# .\build\bin\Release\example.exe +# .\build\bin\Release\example.exe ./examples/features +# displayName: 'Run example' diff --git a/examples/step_definition.cpp b/examples/step_definition.cpp index af3a2b2..ce0305e 100644 --- a/examples/step_definition.cpp +++ b/examples/step_definition.cpp @@ -24,7 +24,7 @@ CUSTOM_PARAMETER( "a custom date pattern") { date begin; - begin.month = std::string(CUKE_PARAM_ARG(1)); + begin.month = std::string{CUKE_PARAM_ARG(1)}; begin.day = int(CUKE_PARAM_ARG(2)); begin.year = CUKE_PARAM_ARG(3).as(); From eb329d87143872029616461f6748cd73dd74993c Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 19:18:31 +0100 Subject: [PATCH 24/39] changed static_cast to to_string() --- .github/workflows/main.yml | 5 +++-- examples/step_definition.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 85d16f4..1072139 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -63,15 +63,16 @@ jobs: pip install cmake conan - name: Conan run: | - conan --version # Check Conan version + conan --version conan profile detect powershell -Command "(gc C:\Users\runneradmin\.conan2\profiles\default) -replace 'compiler.cppstd=14', 'compiler.cppstd=20' | Out-File -encoding ASCII C:\Users\runneradmin\.conan2\profiles\default" powershell -Command "(gc C:\Users\runneradmin\.conan2\profiles\default) -replace 'compiler.runtime=dynamic', 'compiler.runtime=static' | Out-File -encoding ASCII C:\Users\runneradmin\.conan2\profiles\default" + conan profile show - name: Build run: | conan install . -of build --build missing cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" - cmake --build ./build --config Release -j6 + cmake --build ./build --config Release -j12 - name: Unittests run: .\build\bin\Release\unittests.exe - name: Example diff --git a/examples/step_definition.cpp b/examples/step_definition.cpp index ce0305e..dde8c58 100644 --- a/examples/step_definition.cpp +++ b/examples/step_definition.cpp @@ -29,7 +29,7 @@ CUSTOM_PARAMETER( begin.year = CUKE_PARAM_ARG(3).as(); date end; - end.month = static_cast(CUKE_PARAM_ARG(4)); + end.month = CUKE_PARAM_ARG(4).to_string(); end.day = static_cast(CUKE_PARAM_ARG(5)); end.year = CUKE_PARAM_ARG(6).as(); From 3846085c533effc34872b1ea846231a1c81cf7be Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 19:27:01 +0100 Subject: [PATCH 25/39] updated step definition --- examples/step_definition.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/step_definition.cpp b/examples/step_definition.cpp index dde8c58..584454a 100644 --- a/examples/step_definition.cpp +++ b/examples/step_definition.cpp @@ -24,7 +24,7 @@ CUSTOM_PARAMETER( "a custom date pattern") { date begin; - begin.month = std::string{CUKE_PARAM_ARG(1)}; + begin.month = CUKE_PARAM_ARG(1).to_string(); begin.day = int(CUKE_PARAM_ARG(2)); begin.year = CUKE_PARAM_ARG(3).as(); @@ -38,7 +38,8 @@ CUSTOM_PARAMETER( CUSTOM_PARAMETER(custom_event, "{event}", R"('(.*?)')", "a custom event") { - return CUKE_PARAM_ARG(1).to_string(); + std::string event = CUKE_PARAM_ARG(1); + return event; } WHEN(using_date, "{event} is {date}") From 8f53d9d92ded2b8dbb1390f83297059b4bdaea37 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 19:33:16 +0100 Subject: [PATCH 26/39] updated CI --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1072139..03a2aa7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -79,4 +79,4 @@ jobs: run: | dir dir .\build\bin\Release - .\build\bin\Release\example.exe + .\build\bin\Release\example.exe || echo "Exit code: %ERRORLEVEL%" From 078b5930a7422bd4129def6457238a23dd8ee198 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 19:37:50 +0100 Subject: [PATCH 27/39] updated README --- README.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 40e1b3a..37c8813 100644 --- a/README.md +++ b/README.md @@ -576,8 +576,7 @@ In general: A custom parameter type is an individually defined type that we can In order to access the capture groups, use `CUKE_PARAM_ARG(index)` where the index starts at 1 from left to right. **Note: You must explicitly return the dedicated type in the callback. The implementation uses type erasure and does not know which type will be used later.** - - + Find all implementations in `examples/step_definition.cpp` and the examples in `examples/features/8_custom_parameters.feature`. ### Example: Pair of Integers @@ -653,12 +652,12 @@ CUSTOM_PARAMETER( "a custom date pattern") { date begin; - begin.month = std::string(CUKE_PARAM_ARG(1)); + begin.month = CUKE_PARAM_ARG(1).to_string(); begin.day = int(CUKE_PARAM_ARG(2)); begin.year = CUKE_PARAM_ARG(3).as(); date end; - end.month = static_cast(CUKE_PARAM_ARG(4)); + end.month = CUKE_PARAM_ARG(4).to_string(); end.day = static_cast(CUKE_PARAM_ARG(5)); end.year = CUKE_PARAM_ARG(6).as(); @@ -689,6 +688,18 @@ Scenario: Date example Then The beginning month is April and the ending month is Mai ``` +### Strings in Custom Type Parameters + +There are two options in order to create a string value. Some compiler have problems with can not find the correct string type. Therefore we have two options to create a string value from a regex capture: + +Option 1: Dedicated `to_string()` function: +```cpp +CUKE_PARAM_ARG(..).to_string(); +``` +Option 2: Initialize a `std::string` +```cpp +std::string str = CUKE_PARAM_ARG(..) +``` ## Catalog From 1168cfa0a201a0f587343584584412ae65830b9d Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 19:47:04 +0100 Subject: [PATCH 28/39] updated pipelines --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 03a2aa7..8ce9278 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -71,7 +71,7 @@ jobs: - name: Build run: | conan install . -of build --build missing - cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" + cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded cmake --build ./build --config Release -j12 - name: Unittests run: .\build\bin\Release\unittests.exe From e6daf8e5710b65b097ac49df159dccf4bea50d8c Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 19:52:24 +0100 Subject: [PATCH 29/39] updated pipelines --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c1d2b2..0f40e60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,14 @@ if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() +if(MSVC) + add_compile_options( + $<$:/MT> + $<$:/MTd> + $<$:/MT> + ) +endif() + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) From 9ab486a27158b7ee475cd5fe6cbf62adefc28dd9 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 20:00:59 +0100 Subject: [PATCH 30/39] updated pipelines --- .github/workflows/main.yml | 2 +- CMakeLists.txt | 4 +++- README.md | 3 +-- azure-pipelines.yml | 35 ----------------------------------- 4 files changed, 5 insertions(+), 39 deletions(-) delete mode 100644 azure-pipelines.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8ce9278..c2c9cb0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -71,7 +71,7 @@ jobs: - name: Build run: | conan install . -of build --build missing - cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded + cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake -DMSVC_STATIC=ON cmake --build ./build --config Release -j12 - name: Unittests run: .\build\bin\Release\unittests.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f40e60..4573af0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,9 @@ if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() -if(MSVC) +option(MSVC_STATIC "Use static runtime libraries with MSVC" OFF) + +if(MSVC AND MSVC_STATIC) add_compile_options( $<$:/MT> $<$:/MTd> diff --git a/README.md b/README.md index 37c8813..136c01c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -[![CI](https://github.com/ThoSe1990/cucumber-cpp/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/ThoSe1990/cucumber-cpp/actions/workflows/main.yml) [![Build Status](https://dev.azure.com/thomassedlmair/cwt-cucumber/_apis/build/status%2FThoSe1990.cwt-cucumber?branchName=main)](https://dev.azure.com/thomassedlmair/cwt-cucumber/_build/latest?definitionId=14&branchName=main) - +[![CI](https://github.com/ThoSe1990/cucumber-cpp/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/ThoSe1990/cucumber-cpp/actions/workflows/main.yml) ## Coding With Thomas Cucumber: A C++ Cucumber Interpreter diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 9bccf63..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,35 +0,0 @@ -# trigger: -# - 'main' -# -# jobs: -# - job: WindowsBuild -# pool: -# vmImage: 'windows-latest' -# steps: -# - script: | -# choco install python3 -y -# py.exe -m pip install cmake -# py.exe -m pip install conan -# displayName: Install CMake, Conan -# # for now it does its job ... i know the hardcoded paths are ugly... -# - script: | -# set PATH=%PATH%;C:\hostedtoolcache\windows\Python\3.12.7\x64\Scripts -# conan --version # Now you can use Conan -# conan profile detect -# powershell -Command "(gc C:\Users\VssAdministrator\.conan2\profiles\default) -replace 'compiler.cppstd=14', 'compiler.cppstd=20' | Out-File -encoding ASCII C:\Users\VssAdministrator\.conan2\profiles\default" -# powershell -Command "(gc C:\Users\VssAdministrator\.conan2\profiles\default) -replace 'compiler.runtime=dynamic', 'compiler.runtime=static' | Out-File -encoding ASCII C:\Users\VssAdministrator\.conan2\profiles\default" -# displayName: 'Init Conan' -# - script: | -# set PATH=%PATH%;C:\hostedtoolcache\windows\Python\3.12.7\x64\Scripts -# conan install . -of build --build missing -# cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" -# cmake --build ./build --config Release -j6 -# displayName: 'Win Release Build' -# - script: | -# .\build\bin\Release\unittests.exe -# displayName: 'Run Unittests' -# - script: | -# dir .\build\bin\Release -# .\build\bin\Release\example.exe -# .\build\bin\Release\example.exe ./examples/features -# displayName: 'Run example' From 24e70a606c988d9e616f43dbbe59dc1d70c9c3fe Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 20:02:46 +0100 Subject: [PATCH 31/39] updated pipelines --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c2c9cb0..14b9f7c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -71,7 +71,7 @@ jobs: - name: Build run: | conan install . -of build --build missing - cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake -DMSVC_STATIC=ON + cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" -DMSVC_STATIC=ON cmake --build ./build --config Release -j12 - name: Unittests run: .\build\bin\Release\unittests.exe From 8166f3cebdf44697b0cf26de076c9fa6d39016f9 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 20:08:01 +0100 Subject: [PATCH 32/39] updated pipelines --- .github/workflows/main.yml | 5 +---- CMakeLists.txt | 11 ++++++----- examples/CMakeLists.txt | 1 - 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 14b9f7c..ba153f5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -76,7 +76,4 @@ jobs: - name: Unittests run: .\build\bin\Release\unittests.exe - name: Example - run: | - dir - dir .\build\bin\Release - .\build\bin\Release\example.exe || echo "Exit code: %ERRORLEVEL%" + run: .\build\bin\Release\example.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index 4573af0..d463480 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,11 +11,12 @@ endif() option(MSVC_STATIC "Use static runtime libraries with MSVC" OFF) if(MSVC AND MSVC_STATIC) - add_compile_options( - $<$:/MT> - $<$:/MTd> - $<$:/MT> - ) + message(STATUS "MSVC: Setting MT/MTd") + add_compile_options( + $<$:/MT> + $<$:/MTd> + $<$:/MT> + ) endif() set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index d20199c..b9f24a2 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -8,7 +8,6 @@ add_executable(${target} install( TARGETS ${target} COMPONENT test - ) target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/src) From b6e41cf7cb3ac332d535a0b8e9e6f55747e68a56 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 20:10:39 +0100 Subject: [PATCH 33/39] updated pipelines --- CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d463480..2c1d263 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,11 +12,12 @@ option(MSVC_STATIC "Use static runtime libraries with MSVC" OFF) if(MSVC AND MSVC_STATIC) message(STATUS "MSVC: Setting MT/MTd") - add_compile_options( - $<$:/MT> - $<$:/MTd> - $<$:/MT> - ) + # add_compile_options( + # $<$:/MT> + # $<$:/MTd> + # $<$:/MT> + # ) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) From 5a5c4a10af840c7b99bc31864ac2b5b4ee5564d0 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 20:17:07 +0100 Subject: [PATCH 34/39] updated pipelines --- CMakeLists.txt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c1d263..325c084 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,14 +10,9 @@ endif() option(MSVC_STATIC "Use static runtime libraries with MSVC" OFF) -if(MSVC AND MSVC_STATIC) +if(MSVC_STATIC) message(STATUS "MSVC: Setting MT/MTd") - # add_compile_options( - # $<$:/MT> - # $<$:/MTd> - # $<$:/MT> - # ) - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) From 3a0bfe3fb8f92d397d7e3eb7a01dd026c99e313f Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 20:44:17 +0100 Subject: [PATCH 35/39] updated pipelines --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 325c084..bef5c56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,7 @@ option(MSVC_STATIC "Use static runtime libraries with MSVC" OFF) if(MSVC_STATIC) message(STATUS "MSVC: Setting MT/MTd") + cmake_policy(SET CMP0091 NEW) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() From 8b133f565bbd45d8870d6654e6472ba8f7986309 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 21:12:09 +0100 Subject: [PATCH 36/39] moved special_characters inside function body --- src/util_regex.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util_regex.hpp b/src/util_regex.hpp index b351a70..57f93bb 100644 --- a/src/util_regex.hpp +++ b/src/util_regex.hpp @@ -63,12 +63,12 @@ create_regex_definition(const std::string& step) return {result, type_info}; } -static const std::unordered_set special_chars = { - '.', '^', '$', '*', '+', '?', '[', ']', /* '(', ')', */ '\\', - /* '|' */}; - static std::string add_escape_chars(const std::string& input) { + static const std::unordered_set special_chars = { + '.', '^', '$', '*', '+', '?', '[', ']', /* '(', ')', */ '\\', + /* '|' */}; + std::string result; for (char c : input) { From 8ec5025ce850d9624ebd516ee90fbc69775bc653 Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 21:18:14 +0100 Subject: [PATCH 37/39] updated pipeline --- .github/workflows/main.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ba153f5..fb00c43 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,29 +51,29 @@ jobs: MSVC: runs-on: windows-latest steps: - - name: Checkout code + - name: checkout repo uses: actions/checkout@v2 - - name: Set up Python + - name: set up Python uses: actions/setup-python@v2 with: python-version: '3.12' - - name: Install pip tools + - name: install pip tools run: | python -m pip install --upgrade pip pip install cmake conan - - name: Conan + - name: conan run: | conan --version conan profile detect powershell -Command "(gc C:\Users\runneradmin\.conan2\profiles\default) -replace 'compiler.cppstd=14', 'compiler.cppstd=20' | Out-File -encoding ASCII C:\Users\runneradmin\.conan2\profiles\default" powershell -Command "(gc C:\Users\runneradmin\.conan2\profiles\default) -replace 'compiler.runtime=dynamic', 'compiler.runtime=static' | Out-File -encoding ASCII C:\Users\runneradmin\.conan2\profiles\default" conan profile show - - name: Build + - name: build run: | conan install . -of build --build missing cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=".\build\conan_toolchain.cmake" -DMSVC_STATIC=ON cmake --build ./build --config Release -j12 - - name: Unittests + - name: unittests run: .\build\bin\Release\unittests.exe - - name: Example - run: .\build\bin\Release\example.exe + - name: example + run: .\build\bin\Release\example.exe ./examples From 4ab219727462e69c6ccf6ea208067443e9d4a2ab Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 22:08:43 +0100 Subject: [PATCH 38/39] updated conversion for std::size_t in order to work with msvc --- src/get_args.hpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/get_args.hpp b/src/get_args.hpp index a3d355f..afa92f0 100644 --- a/src/get_args.hpp +++ b/src/get_args.hpp @@ -1,7 +1,9 @@ #pragma once +#include #include #include +#include #include "param_info.hpp" #include "value.hpp" @@ -20,8 +22,16 @@ struct conversion template operator T() const { - return cuke::registry().get_expression(key).callback(begin + idx, - values_count); + // NOTE: MSVC treats std::size_t differently then mac/linux + if constexpr (std::is_same_v) + { + return make_parameter_value(begin + idx, values_count); + } + else + { + return cuke::registry().get_expression(key).callback(begin + idx, + values_count); + } } }; From 554c3a5ad38559251b2e2beda9de8fef5701227d Mon Sep 17 00:00:00 2001 From: Thomas Sedlmair Date: Wed, 13 Nov 2024 22:17:42 +0100 Subject: [PATCH 39/39] updated CHANGELOG --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4844fc6..5e869a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,6 @@ - Define custom types with `CUSTOM_PARAMETER(function-name, "{your type}", "regex pattern", "description") { your callback implementation }` - In your callback implement how to consume capture groups - Access capture groups with `CUKE_PARAM_ARG(index)`, where index starts at 1 and goes from left to write -- Description is an argument in `CUKE_PARAMETER` ([57](https://github.com/ThoSe1990/cwt-cucumber/pull/57)) - Renamed example target `box` to `example` ([56](https://github.com/ThoSe1990/cwt-cucumber/pull/56)) ## [2.3.1] 2024-10-23