Commit 2fb7fc1 1 parent c1efff3 commit 2fb7fc1 Copy full SHA for 2fb7fc1
File tree 2 files changed +13
-4
lines changed
crates/rattler_conda_types/src/version_spec
2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -236,9 +236,12 @@ mod test {
236
236
Constraint :: from_str( "=1.2.*" , Strict ) ,
237
237
Err ( ParseConstraintError :: GlobVersionIncompatibleWithOperator ( _) )
238
238
) ;
239
- assert_matches ! (
240
- Constraint :: from_str( "!=1.2.*" , Strict ) ,
241
- Err ( ParseConstraintError :: GlobVersionIncompatibleWithOperator ( _) )
239
+ assert_eq ! (
240
+ Constraint :: from_str( "!=1.2.*" , Lenient ) ,
241
+ Ok ( Constraint :: StrictComparison (
242
+ StrictRangeOperator :: NotStartsWith ,
243
+ Version :: from_str( "1.2" ) . unwrap( ) ,
244
+ ) )
242
245
) ;
243
246
assert_matches ! (
244
247
Constraint :: from_str( ">=1.2.*" , Strict ) ,
Original file line number Diff line number Diff line change @@ -210,7 +210,13 @@ fn logical_constraint_parser(
210
210
) ) ,
211
211
Lenient ,
212
212
) => VersionOperators :: Range ( RangeOperator :: GreaterEquals ) ,
213
- ( "*" | ".*" , Some ( VersionOperators :: Exact ( EqualityOperator :: NotEquals ) ) , Lenient ) => {
213
+ (
214
+ "*" | ".*" ,
215
+ Some ( VersionOperators :: Exact ( EqualityOperator :: NotEquals ) ) ,
216
+ Lenient | Strict ,
217
+ ) => {
218
+ // !=1.2.3.* is the only way to express a version should not start with 1.2.3 so
219
+ // even in strict mode we allow this.
214
220
VersionOperators :: StrictRange ( StrictRangeOperator :: NotStartsWith )
215
221
}
216
222
( "*" | ".*" , Some ( op) , Lenient ) => {
You can’t perform that action at this time.
0 commit comments