Skip to content

Commit 5e87530

Browse files
committed
fix tests and formatting to comply with dtolnay#196
1 parent 3c0a9cd commit 5e87530

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
@@ -527,7 +527,7 @@ impl fmt::Display for Predicate {
527527
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
528528
write!(
529529
fmt,
530-
"{} {}.{}.{}",
530+
"{}{}.{}.{}",
531531
self.op, self.major, self.minor, self.patch
532532
)?;
533533

@@ -613,7 +613,7 @@ mod test {
613613
fn test_parsing_default_node() {
614614
let r = req_node("1.0.0");
615615

616-
assert_eq!(r.to_string(), "= 1.0.0".to_string());
616+
assert_eq!(r.to_string(), "=1.0.0".to_string());
617617

618618
assert_match(&r, &["1.0.0"]);
619619
assert_not_match(&r, &["0.9.9", "0.10.0", "0.1.0", "1.0.1"]);
@@ -740,27 +740,27 @@ mod test {
740740
#[test]
741741
pub fn test_multiple_node() {
742742
let r = req_node("> 0.0.9, <= 2.5.3");
743-
assert_eq!(r.to_string(), "> 0.0.9 <= 2.5.3".to_string());
743+
assert_eq!(r.to_string(), ">0.0.9 <=2.5.3".to_string());
744744
assert_match(&r, &["0.0.10", "1.0.0", "2.5.3"]);
745745
assert_not_match(&r, &["0.0.8", "2.5.4"]);
746746

747747
let r = req_node("0.3.0, 0.4.0");
748-
assert_eq!(r.to_string(), "= 0.3.0 = 0.4.0".to_string());
748+
assert_eq!(r.to_string(), "=0.3.0 =0.4.0".to_string());
749749
assert_not_match(&r, &["0.0.8", "0.3.0", "0.4.0"]);
750750

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

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

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

762762
let r = req_node(">=0.5.1-alpha3, <0.6");
763-
assert_eq!(r.to_string(), ">= 0.5.1-alpha3 < 0.6.0".to_string());
763+
assert_eq!(r.to_string(), ">=0.5.1-alpha3 <0.6.0".to_string());
764764
assert_match(
765765
&r,
766766
&[
@@ -908,20 +908,20 @@ mod test {
908908
#[test]
909909
pub fn test_parsing_logical_or() {
910910
let r = req("=1.2.3 || =2.3.4");
911-
assert_eq!(r.to_string(), "= 1.2.3 || = 2.3.4".to_string());
911+
assert_eq!(r.to_string(), "=1.2.3 || =2.3.4".to_string());
912912
assert_match(&r, &["1.2.3", "2.3.4"]);
913913
assert_not_match(&r, &["1.0.0", "2.9.0", "0.1.4"]);
914914
assert_not_match(&r, &["1.2.3-beta1", "2.3.4-alpha", "1.2.3-pre"]);
915915

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

921921
let r = req("6.* || 8.* || >= 10.*");
922922
assert_eq!(
923923
r.to_string(),
924-
">= 6.0.0, < 7.0.0 || >= 8.0.0, < 9.0.0 || >= 10.0.0".to_string()
924+
">=6.0.0, <7.0.0 || >=8.0.0, <9.0.0 || >=10.0.0".to_string()
925925
);
926926
assert_match(&r, &["6.0.0", "6.1.2"]);
927927
assert_match(&r, &["8.0.0", "8.2.4"]);
@@ -932,20 +932,20 @@ mod test {
932932
#[test]
933933
pub fn test_parsing_logical_or_node() {
934934
let r = req_node("=1.2.3 || =2.3.4");
935-
assert_eq!(r.to_string(), "= 1.2.3 || = 2.3.4".to_string());
935+
assert_eq!(r.to_string(), "=1.2.3 || =2.3.4".to_string());
936936
assert_match(&r, &["1.2.3", "2.3.4"]);
937937
assert_not_match(&r, &["1.0.0", "2.9.0", "0.1.4"]);
938938
assert_not_match(&r, &["1.2.3-beta1", "2.3.4-alpha", "1.2.3-pre"]);
939939

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

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

0 commit comments

Comments
 (0)