Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions evaluator/flags/testkit-flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
19 changes: 18 additions & 1 deletion evaluator/gherkin/semver.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<type>" and with value "<version>"
Expand All @@ -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 "<type>" and with value "<version>"
When the flag was evaluated with details
Then the resolved details value should be "<value>"
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
Expand Down
14 changes: 14 additions & 0 deletions flags/custom-ops.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
18 changes: 17 additions & 1 deletion gherkin/targeting.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<type>" and with value "<version>"
When the flag was evaluated with details
Expand All @@ -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 "<type>" and with value "<version>"
When the flag was evaluated with details
Then the resolved details value should be "<value>"
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"
Expand Down
Loading