Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename Compat::Node to Compat::Npm #48

Merged
merged 1 commit into from Sep 15, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main.rs
Expand Up @@ -7,8 +7,8 @@ fn main() -> Result<(), Box<dyn Error>> {
let range_set: RangeSet = "1.2.3".parse()?;
println!("Found range set: {:?}", range_set);

// node compatibility
let range_set = RangeSet::parse("1.2.3", Compat::Node)?;
// npm compatibility
let range_set = RangeSet::parse("1.2.3", Compat::Npm)?;
println!("Found range set (node): {:?}", range_set);

Ok(())
Expand Down
6 changes: 3 additions & 3 deletions src/range.rs
Expand Up @@ -183,7 +183,7 @@ pub mod simple {
}
PartialKind::MajorMinorPatch => {
match compat {
range_set::Compat::Node => {
range_set::Compat::Npm => {
// for node, "1.2.3" is "=1.2.3"
comparators.push(partial.as_comparator(Op::Eq));
}
Expand Down Expand Up @@ -612,7 +612,7 @@ mod tests {
let (input, expected_range) = $value;

let parsed_range = parse_range(input);
let range = from_pair_iterator(parsed_range, range_set::Compat::Node).expect("parsing failed");
let range = from_pair_iterator(parsed_range, range_set::Compat::Npm).expect("parsing failed");

// get the expected length from the input range
let num_comparators = range.comparator_set.len();
Expand Down Expand Up @@ -676,7 +676,7 @@ mod tests {
},
)*
],
compat: range_set::Compat::Node
compat: range_set::Compat::Npm
}
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/range_set.rs
Expand Up @@ -12,7 +12,7 @@ pub struct RangeSet {
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum Compat {
Cargo, // default
Node,
Npm,
}

impl RangeSet {
Expand Down Expand Up @@ -112,7 +112,7 @@ mod tests {
fn $name() {
let expected_sets = vec![$($x)*];

let range_set = RangeSet::parse($input, Compat::Node).expect("parse failed");
let range_set = RangeSet::parse($input, Compat::Npm).expect("parse failed");

assert_eq!(range_set.ranges.len(), expected_sets.len());
for it in range_set.ranges.iter().zip(expected_sets.iter()) {
Expand Down