diff --git a/evaluator/flags/testkit-flags.json b/evaluator/flags/testkit-flags.json index 1db5f14..8f5e379 100644 --- a/evaluator/flags/testkit-flags.json +++ b/evaluator/flags/testkit-flags.json @@ -521,6 +521,14 @@ "if": [{"sem_ver": [{"var": "version"}, "=", "1.0.0+build"]}, "match", "no-match"] } }, + "semver-numeric-context-flag": { + "state": "ENABLED", + "variants": { "match": "match", "no-match": "no-match" }, + "defaultVariant": "no-match", + "targeting": { + "if": [{"sem_ver": [{"var": "version"}, ">", "1.1"]}, "match", "no-match"] + } + }, "ref-whitespace-compact-flag": { "state": "ENABLED", "variants": { diff --git a/evaluator/gherkin/semver.feature b/evaluator/gherkin/semver.feature index 18c5130..1b136f2 100644 --- a/evaluator/gherkin/semver.feature +++ b/evaluator/gherkin/semver.feature @@ -60,7 +60,7 @@ Feature: Evaluator semantic version operator | 2.0.0 | no-match | @semver-edge-cases @semver-partial-version - Scenario Outline: partial version handling + Scenario Outline: partial version string handling Given an evaluator And a String-flag with key "semver-partial-version-flag" and a fallback value "fallback" And a context containing a key "version", with type "" and with value "" @@ -73,8 +73,25 @@ Feature: Evaluator semantic version operator | 1.0 | String | match | | 1 | String | match | | 1 | Integer | match | + | 1 | Float | match | + | 1.2 | Float | match | | 2.0.0 | String | no-match | + @semver-edge-cases @semver-numeric-context + Scenario Outline: numeric context value coercion + Given an evaluator + And a String-flag with key "semver-numeric-context-flag" and a fallback value "fallback" + And a context containing a key "version", with type "" and with value "" + When the flag was evaluated with details + Then the resolved details value should be "" + Examples: + | version | type | value | + | 1.2 | Float | match | + | 1.1 | Float | no-match | + | 2 | Integer | match | + | 1 | Integer | no-match | + | 1.2 | String | match | + @semver-edge-cases @semver-build-metadata Scenario Outline: build metadata ignored in comparison Given an evaluator diff --git a/flags/custom-ops.json b/flags/custom-ops.json index 27d1c96..c2334a0 100644 --- a/flags/custom-ops.json +++ b/flags/custom-ops.json @@ -341,6 +341,20 @@ ] } }, + "semver-numeric-context-flag": { + "state": "ENABLED", + "variants": { + "match": "match", + "no-match": "no-match" + }, + "defaultVariant": "no-match", + "targeting": { + "if": [ + {"sem_ver": [{"var": "version"}, ">", "1.1"]}, + "match", "no-match" + ] + } + }, "semver-build-metadata-flag": { "state": "ENABLED", "variants": { diff --git a/gherkin/targeting.feature b/gherkin/targeting.feature index ec90364..2e23dd1 100644 --- a/gherkin/targeting.feature +++ b/gherkin/targeting.feature @@ -283,7 +283,7 @@ Feature: Targeting rules | 2.0.0 | no-match | @semver @semver-edge-cases @semver-partial-version - Scenario Outline: sem_ver partial version handling + Scenario Outline: sem_ver partial version string handling Given a String-flag with key "semver-partial-version-flag" and a default value "fallback" And a context containing a key "version", with type "" and with value "" When the flag was evaluated with details @@ -295,8 +295,24 @@ Feature: Targeting rules | 1.0 | String | match | | 1 | String | match | | 1 | Integer | match | + | 1 | Float | match | + | 1.2 | Float | match | | 2.0.0 | String | no-match | + @semver @semver-edge-cases @semver-numeric-context + Scenario Outline: sem_ver numeric context value coercion + Given a String-flag with key "semver-numeric-context-flag" and a default value "fallback" + And a context containing a key "version", with type "" and with value "" + When the flag was evaluated with details + Then the resolved details value should be "" + Examples: + | version | type | value | + | 1.2 | Float | match | + | 1.1 | Float | no-match | + | 2 | Integer | match | + | 1 | Integer | no-match | + | 1.2 | String | match | + @semver @semver-edge-cases @semver-build-metadata Scenario Outline: sem_ver build metadata ignored Given a String-flag with key "semver-build-metadata-flag" and a default value "fallback"