summaryrefslogtreecommitdiff
path: root/cli/npm/semver
diff options
context:
space:
mode:
Diffstat (limited to 'cli/npm/semver')
-rw-r--r--cli/npm/semver/mod.rs6
-rw-r--r--cli/npm/semver/specifier.rs9
2 files changed, 8 insertions, 7 deletions
diff --git a/cli/npm/semver/mod.rs b/cli/npm/semver/mod.rs
index 2b5cc5a03..10a87a13f 100644
--- a/cli/npm/semver/mod.rs
+++ b/cli/npm/semver/mod.rs
@@ -313,9 +313,7 @@ fn simple(input: &str) -> ParseResult<VersionRange> {
}
}
}),
- map(partial, |partial| {
- partial.as_greater_range(VersionBoundKind::Inclusive)
- }),
+ map(partial, |partial| partial.as_equal_range()),
)(input)
}
@@ -842,6 +840,8 @@ mod tests {
("1.0.0 - x", "1.9.7"),
("1.x - x", "1.9.7"),
("<=7.x", "7.9.9"),
+ // additional tests
+ ("1.0.0-alpha.13", "1.0.0-alpha.13"),
];
for (req_text, version_text) in fixtures {
let req = NpmVersionReq::parse(req_text).unwrap();
diff --git a/cli/npm/semver/specifier.rs b/cli/npm/semver/specifier.rs
index 019360422..64e3c4f9b 100644
--- a/cli/npm/semver/specifier.rs
+++ b/cli/npm/semver/specifier.rs
@@ -6,7 +6,6 @@ use monch::*;
use super::errors::with_failure_handling;
use super::range::Partial;
-use super::range::VersionBoundKind;
use super::range::VersionRange;
use super::range::XRange;
use super::NpmVersion;
@@ -57,9 +56,7 @@ fn version_range(input: &str) -> ParseResult<VersionRange> {
map(preceded(ch('^'), partial), |partial| {
partial.as_caret_version_range()
}),
- map(partial, |partial| {
- partial.as_greater_range(VersionBoundKind::Inclusive)
- }),
+ map(partial, |partial| partial.as_equal_range()),
)(input)
}
@@ -186,6 +183,10 @@ mod tests {
assert!(tester.matches("1.0.1"));
assert!(!tester.matches("1.0.2"));
assert!(!tester.matches("1.1.1"));
+
+ // pre-release
+ let tester = VersionReqTester::new("1.0.0-alpha.13");
+ assert!(tester.matches("1.0.0-alpha.13"));
}
#[test]