Skip to content

Commit 06263ac

Browse files
yoshielpil
authored andcommitted
fix and version range parsing
1 parent 8dde633 commit 06263ac

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

src/version/parser.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ impl<'input> Parser<'input> {
372372

373373
Some(_) => return Err(UnexpectedToken(self.pop()?.to_string())),
374374
};
375+
376+
self.skip_whitespace()?;
375377
if self.peek() == Some(&Token::And) {
376378
self.pop()?;
377379
self.expect_whitespace()?;

src/version/tests.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,37 @@ parse_range_test!(
320320
)
321321
);
322322

323+
parse_range_test!(
324+
pessimistic_and_gt,
325+
"~> 0.6 and >= 0.6.16",
326+
PubgrubRange::higher_than(v(0, 6, 0))
327+
.intersection(&PubgrubRange::strictly_lower_than(v(1, 0, 0)))
328+
.intersection(&PubgrubRange::higher_than(v(0, 6, 16)))
329+
);
330+
331+
parse_range_test!(
332+
pessimistic_and_gt_pre,
333+
"~> 1.0-pre and >= 1.0.0-pre.5",
334+
PubgrubRange::higher_than(v_(
335+
1,
336+
0,
337+
0,
338+
vec![Identifier::AlphaNumeric("pre".to_string())],
339+
None
340+
))
341+
.intersection(&PubgrubRange::strictly_lower_than(v(2, 0, 0)))
342+
.intersection(&PubgrubRange::higher_than(v_(
343+
1,
344+
0,
345+
0,
346+
vec![
347+
Identifier::AlphaNumeric("pre".to_string()),
348+
Identifier::Numeric(5)
349+
],
350+
None
351+
)))
352+
);
353+
323354
parse_range_fail_test!(range_quad, "1.1.1.1");
324355
parse_range_fail_test!(range_just_major, "1");
325356
parse_range_fail_test!(range_just_major_minor, "1.1");

0 commit comments

Comments
 (0)