Skip to content
Open
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
24 changes: 24 additions & 0 deletions evaluator/flags/testkit-flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,30 @@
["two", 50]
]
}
},
"semver-v-prefix-flag": {
"state": "ENABLED",
"variants": { "match": "match", "no-match": "no-match" },
"defaultVariant": "no-match",
"targeting": {
"if": [{"sem_ver": [{"var": "version"}, "=", "v1.0.0"]}, "match", "no-match"]
}
},
"semver-partial-version-flag": {
"state": "ENABLED",
"variants": { "match": "match", "no-match": "no-match" },
"defaultVariant": "no-match",
"targeting": {
"if": [{"sem_ver": [{"var": "version"}, "^", "1"]}, "match", "no-match"]
}
},
"semver-build-metadata-flag": {
"state": "ENABLED",
"variants": { "match": "match", "no-match": "no-match" },
"defaultVariant": "no-match",
"targeting": {
"if": [{"sem_ver": [{"var": "version"}, "=", "1.0.0+build"]}, "match", "no-match"]
}
}
},
"$evaluators": {
Expand Down
39 changes: 39 additions & 0 deletions evaluator/gherkin/semver.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,42 @@ Feature: Evaluator semantic version operator
| key | context_value |
| semver-invalid-version-flag | not-a-version |
| semver-invalid-operator-flag | 1.0.0 |

@semver-edge-cases @semver-v-prefix
Scenario Outline: v-prefix handling
Given an evaluator
And a String-flag with key "semver-v-prefix-flag" and a fallback value "fallback"
And a context containing a key "version", with type "String" and with value "<version>"
When the flag was evaluated with details
Then the resolved details value should be "<value>"
Examples:
| version | value |
| 1.0.0 | match |
| v1.0.0 | match |
| 2.0.0 | no-match |

@semver-edge-cases @semver-partial-version
Scenario Outline: partial version 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 "String" and with value "<version>"
When the flag was evaluated with details
Then the resolved details value should be "<value>"
Examples:
| version | value |
| 1.5.0 | match |
| 1.0.0 | match |
| 2.0.0 | no-match |

@semver-edge-cases @semver-build-metadata
Scenario Outline: build metadata ignored in comparison
Given an evaluator
And a String-flag with key "semver-build-metadata-flag" and a fallback value "fallback"
And a context containing a key "version", with type "String" and with value "<version>"
When the flag was evaluated with details
Then the resolved details value should be "<value>"
Examples:
| version | value |
| 1.0.0 | match |
| 1.0.0+other | match |
| 2.0.0 | no-match |
42 changes: 42 additions & 0 deletions flags/custom-ops.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,48 @@
}
]
}
},
"semver-v-prefix-flag": {
"state": "ENABLED",
"variants": {
"match": "match",
"no-match": "no-match"
},
"defaultVariant": "no-match",
"targeting": {
"if": [
{"sem_ver": [{"var": "version"}, "=", "v1.0.0"]},
"match", "no-match"
]
}
},
"semver-partial-version-flag": {
"state": "ENABLED",
"variants": {
"match": "match",
"no-match": "no-match"
},
"defaultVariant": "no-match",
"targeting": {
"if": [
{"sem_ver": [{"var": "version"}, "^", "1"]},
"match", "no-match"
]
}
},
"semver-build-metadata-flag": {
"state": "ENABLED",
"variants": {
"match": "match",
"no-match": "no-match"
},
"defaultVariant": "no-match",
"targeting": {
"if": [
{"sem_ver": [{"var": "version"}, "=", "1.0.0+build"]},
"match", "no-match"
]
}
}
}
}
36 changes: 36 additions & 0 deletions gherkin/targeting.feature
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,42 @@ Feature: Targeting rules
| 3.1.0 | major |
| 4.0.0 | none |

@semver @semver-edge-cases @semver-v-prefix
Scenario Outline: sem_ver v-prefix handling
Given a String-flag with key "semver-v-prefix-flag" and a default value "fallback"
And a context containing a key "version", with type "String" and with value "<version>"
When the flag was evaluated with details
Then the resolved details value should be "<value>"
Examples:
| version | value |
| 1.0.0 | match |
| v1.0.0 | match |
| 2.0.0 | no-match |

@semver @semver-edge-cases @semver-partial-version
Scenario Outline: sem_ver partial version 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 "String" and with value "<version>"
When the flag was evaluated with details
Then the resolved details value should be "<value>"
Examples:
| version | value |
| 1.5.0 | match |
| 1.0.0 | match |
| 2.0.0 | no-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"
And a context containing a key "version", with type "String" and with value "<version>"
When the flag was evaluated with details
Then the resolved details value should be "<value>"
Examples:
| version | value |
| 1.0.0 | match |
| 1.0.0+other | match |
| 2.0.0 | no-match |

Scenario Outline: Time-based operations
Given a Integer-flag with key "timestamp-flag" and a default value "0"
And a context containing a key "time", with type "Integer" and with value "<time>"
Expand Down
Loading