Skip to content

Commit fb8e697

Browse files
committed
fix tests and formatting to comply with dtolnay#196
1 parent 210427e commit fb8e697

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/version_req.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ impl fmt::Display for Predicate {
529529
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
530530
write!(
531531
fmt,
532-
"{} {}.{}.{}",
532+
"{}{}.{}.{}",
533533
self.op, self.major, self.minor, self.patch
534534
)?;
535535

@@ -615,7 +615,7 @@ mod test {
615615
fn test_parsing_default_node() {
616616
let r = req_node("1.0.0");
617617

618-
assert_eq!(r.to_string(), "= 1.0.0".to_string());
618+
assert_eq!(r.to_string(), "=1.0.0".to_string());
619619

620620
assert_match(&r, &["1.0.0"]);
621621
assert_not_match(&r, &["0.9.9", "0.10.0", "0.1.0", "1.0.1"]);
@@ -742,27 +742,27 @@ mod test {
742742
#[test]
743743
pub fn test_multiple_node() {
744744
let r = req_node("> 0.0.9, <= 2.5.3");
745-
assert_eq!(r.to_string(), "> 0.0.9 <= 2.5.3".to_string());
745+
assert_eq!(r.to_string(), ">0.0.9 <=2.5.3".to_string());
746746
assert_match(&r, &["0.0.10", "1.0.0", "2.5.3"]);
747747
assert_not_match(&r, &["0.0.8", "2.5.4"]);
748748

749749
let r = req_node("0.3.0, 0.4.0");
750-
assert_eq!(r.to_string(), "= 0.3.0 = 0.4.0".to_string());
750+
assert_eq!(r.to_string(), "=0.3.0 =0.4.0".to_string());
751751
assert_not_match(&r, &["0.0.8", "0.3.0", "0.4.0"]);
752752

753753
let r = req_node("<= 0.2.0, >= 0.5.0");
754-
assert_eq!(r.to_string(), "<= 0.2.0 >= 0.5.0".to_string());
754+
assert_eq!(r.to_string(), "<=0.2.0 >=0.5.0".to_string());
755755
assert_not_match(&r, &["0.0.8", "0.3.0", "0.5.1"]);
756756

757757
let r = req_node("0.1.0, 0.1.4, 0.1.6");
758-
assert_eq!(r.to_string(), "= 0.1.0 = 0.1.4 = 0.1.6".to_string());
758+
assert_eq!(r.to_string(), "=0.1.0 =0.1.4 =0.1.6".to_string());
759759
assert_not_match(&r, &["0.1.0", "0.1.4", "0.1.6", "0.2.0"]);
760760

761761
assert!(VersionReq::parse("> 0.1.0,").is_err());
762762
assert!(VersionReq::parse("> 0.3.0, ,").is_err());
763763

764764
let r = req_node(">=0.5.1-alpha3, <0.6");
765-
assert_eq!(r.to_string(), ">= 0.5.1-alpha3 < 0.6.0".to_string());
765+
assert_eq!(r.to_string(), ">=0.5.1-alpha3 <0.6.0".to_string());
766766
assert_match(
767767
&r,
768768
&[
@@ -910,20 +910,20 @@ mod test {
910910
#[test]
911911
pub fn test_parsing_logical_or() {
912912
let r = req("=1.2.3 || =2.3.4");
913-
assert_eq!(r.to_string(), "= 1.2.3 || = 2.3.4".to_string());
913+
assert_eq!(r.to_string(), "=1.2.3 || =2.3.4".to_string());
914914
assert_match(&r, &["1.2.3", "2.3.4"]);
915915
assert_not_match(&r, &["1.0.0", "2.9.0", "0.1.4"]);
916916
assert_not_match(&r, &["1.2.3-beta1", "2.3.4-alpha", "1.2.3-pre"]);
917917

918918
let r = req("1.1 || =1.2.3");
919-
assert_eq!(r.to_string(), ">= 1.1.0, < 1.2.0 || = 1.2.3".to_string());
919+
assert_eq!(r.to_string(), ">=1.1.0, <1.2.0 || =1.2.3".to_string());
920920
assert_match(&r, &["1.1.0", "1.1.12", "1.2.3"]);
921921
assert_not_match(&r, &["1.0.0", "1.2.2", "1.3.0"]);
922922

923923
let r = req("6.* || 8.* || >= 10.*");
924924
assert_eq!(
925925
r.to_string(),
926-
">= 6.0.0, < 7.0.0 || >= 8.0.0, < 9.0.0 || >= 10.0.0".to_string()
926+
">=6.0.0, <7.0.0 || >=8.0.0, <9.0.0 || >=10.0.0".to_string()
927927
);
928928
assert_match(&r, &["6.0.0", "6.1.2"]);
929929
assert_match(&r, &["8.0.0", "8.2.4"]);
@@ -934,20 +934,20 @@ mod test {
934934
#[test]
935935
pub fn test_parsing_logical_or_node() {
936936
let r = req_node("=1.2.3 || =2.3.4");
937-
assert_eq!(r.to_string(), "= 1.2.3 || = 2.3.4".to_string());
937+
assert_eq!(r.to_string(), "=1.2.3 || =2.3.4".to_string());
938938
assert_match(&r, &["1.2.3", "2.3.4"]);
939939
assert_not_match(&r, &["1.0.0", "2.9.0", "0.1.4"]);
940940
assert_not_match(&r, &["1.2.3-beta1", "2.3.4-alpha", "1.2.3-pre"]);
941941

942942
let r = req_node("1.1 || =1.2.3");
943-
assert_eq!(r.to_string(), ">= 1.1.0 < 1.2.0 || = 1.2.3".to_string());
943+
assert_eq!(r.to_string(), ">=1.1.0 <1.2.0 || =1.2.3".to_string());
944944
assert_match(&r, &["1.1.0", "1.1.12", "1.2.3"]);
945945
assert_not_match(&r, &["1.0.0", "1.2.2", "1.3.0"]);
946946

947947
let r = req_node("6.* || 8.* || >= 10.*");
948948
assert_eq!(
949949
r.to_string(),
950-
">= 6.0.0 < 7.0.0 || >= 8.0.0 < 9.0.0 || >= 10.0.0".to_string()
950+
">=6.0.0 <7.0.0 || >=8.0.0 <9.0.0 || >=10.0.0".to_string()
951951
);
952952
assert_match(&r, &["6.0.0", "6.1.2"]);
953953
assert_match(&r, &["8.0.0", "8.2.4"]);

0 commit comments

Comments
 (0)