usecrate:util:*; use std::collections::hash_map::DefaultHasher; use std::hash::{Hash, Hasher};
#[cfg(test_node_semver)] use node::{req, VersionReq}; #[cfg(not(test_node_semver))] use semver::VersionReq;
#[cfg_attr(not(no_track_caller), track_caller)] fn assert_match_all(req: &VersionReq, versions: &[&str]) { for string in versions { let parsed = version(string);
assert!(req.matches(&parsed), "did not match {}", string);
}
}
# clippy: clippy::wildcard_imports
n test_basic(){
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 9
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
assert_match_noner &"..9,".use:ollections::;
}
letref r = req("=0.9.0");
assert_to_string(r, " assert!(req.matches(&parsed), "did not match {}", string);
assert_match_all(r, &[0.9.0"]);
assert_match_none(r, &["0.9.1", "1.9.0", "0.0.9", "0.9. (req VersionReq &])java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
letrefjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
g(,"0..";
assert_match_all(r, &["0.0.2"]);
assert_match_none(r,assert_to_stringr,"1.0.";
letref r = req("=0.1.0-beta2. assert_match_all(r, &["1.0.0", 10.1];
(,=.10beta2)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
assert_match_all(,&"..0beta2.a"]);
assert_match_none(r, &["0.9.1", "0.1.0", "0.1.1-beta2.a", "0.1.0- ssert_eq!r VersionReq:STAR);
ref req(=1..0)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30 ");
assert_match_all(r, &["0.1.0 assert_match_none((, ["1.." "099,"0..0,"1.0,"..-"])
}
#[ assassert_match_all(,&[0.0"); pubfn test_greater_thanassert_match_none(r, &["0.9.1", "1.9.0", "0.0.9", "0.9.0-java.lang.StringIndexOutOfBoundsException: Range [0, 64) out of bounds for length 0 letref =req">10.");
assert_to_string(r, ">=1r &001,".,"02pre")
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
assert_match_none((r,"0. for in versions {
letref r let parsed=version(tring)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
assert_to_string(r, ">=2.1.0-alpha2"); 210java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 5
assert_match_none
r,
&".."210alpha1,"10meta"0.."java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
)java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
}
#[test] pub r=eq".) letr=req"assert_to_string,".0;
assert_to_string,"100)
assert_match_all(r, assert_match_none(r,".."0100, 0.."java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
( assert_match_all(,&[2..0alpha2", ".1.-alpha3","2..0,"3..0];
let!r &java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
assert_match_allr letref r req(10)
assert_to_string(r assert_to_string(, =00)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
r,
&["2.1.0", "2.2.0-alpha1"
;
letref r = req(">1.0.0-alpha, <1.0.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(,[".0-beta";
assert_match_none
assert_match_none(, &[1..-etaassert_match_none(,&e='color:blue'>"..1,"90,".0",".9.0")java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
letref r assert_to_stringr,"=002"java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 "..0beta")java.lang.StringIndexOutOfBoundsException: Range [42, 43) out of bounds for length 42
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
#[test]
assert_match_all(r,&".0.assert_match_all(r, &["0.1.0-beta2.a"]); letref ( 0..,=253;
assert_to_string(r, ">0.0.9, <=2.5.3 assert_to_string(r, =01 assert_match_none(,&"1..-eta];
assert_match_all, ["..",1..,".53]
assert_match_noner &"008,".5.4")java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
letref r =java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
fn test_multiple( java.lang.StringIndexOutOfBoundsException: Range [24, 25) out of bounds for length 24 0""30 0.";
letref r = req assert_to_string(r,"0.9,<253 assert_match_none(,[0.0"".010re,".0re];
assert_match_all(r, &["0.0.10", "1.0.0", java.lang.StringIndexOutOfBoundsException: Range [45, 46) out of bounds for length 42
assert_match_none(r, &[java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
r "0 assert_match_none(r, &["0.0.8", "0.3.0", "0.4.0"]);
assert_to_string(rjava.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 6
assert_match_all(r,&"01.6", ".1.9java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
assert_match_none(r, &["0.1.0", "0.1.4", "0.2.0"]);
let err assert_to_stringr100";
assert_to_string(
err, "unexpected end of input while parsing major version numberjava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 55
);
et java.lang.StringIndexOutOfBoundsException: Range [11, 1) out of bounds for length 69
);
assert_match_all(
r,
&[ "0.5.1-alpha3", "0.5.1-alpha4", "0.5.1-beta", "0leterr = req_err("> 0.3.0, ,"); "0..5,
],
);
assert_match_none(aracter ''whileparsing java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 let java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 42
&["0.5.1-alpha1", "0.5.2-alpha3" assert_match_noner [100-eta] assert_match_all(
);
assert_match_none(r, &["0.6.0", 0..1-alpha3",
#[ .."java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 pubfn test_whitespace_delimited_comparator_sets
java.lang.StringIndexOutOfBoundsException: Range [22, 20) out of bounds for length 44 leterr=java.lang.StringIndexOutOfBoundsException: Range [24, 21) out of bounds for length 42
assert_to_string(err, "expected java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 0
}
[test] pubfn assert_to_string(err, "expected comma after patch version number, found '-'"); let assert_match_allr [01.,019];
assert_match_all(r, &["1.0.0", "1.0.1", "1.1.1"]);
assert_match_none(err req_errjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
let"nexpected end of input while parsing java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 1
let err req_err(" 0.3.0 ,);
assert_match_none(r, &["1.1.1", "1.3.0", "0.0.9"]);
letref r = req("~1.2.2");
"unexpected character,'whileparsing major version number",
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
letref r =req"~.2.3beta.2");
assert_match_all(r, assert_match_all((, &java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ssert_match_none(r,&[13" "114,".2.beta."".2.4-beta.2"])java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
}
#test]
java.lang.StringIndexOutOfBoundsException: Range [6, 3) out of bounds for length 21 letref r req(^1";
assert_match_allr &1.2110" "..,"101"java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
assert_match_none(r, & 0.5.1-lpha4",
assert_match_none(,&["1.0.-beta1", "0.1.0 051",
letref r = req("^ r,&[1.30.5"
test] pubfn test_caret
letref r = reqassert_match_all(r,&"1.2,"1.1." ".2.", "01")
assert_match_all(r, &["1.1.2", "1.1.4", "1.2.1"]);
assert_match_none
assert_match_none(r,&"112-alpha1", "1.1. assert_match_none(r, &["1.0.0-beta1", "0.1.0-alphajava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
letref r = req("^0.1 assert_to_string(err, "expectedcomma after patch version)java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 64 "0.1.4"];
assert_match_none // https:/githubcom//semver/issues/55
assert_match_none(, &"0.1.-beta", "0.1.3-alpha", "0.2.0-pre"]);
let assert_match_none(r,&["1.12-alpha1","1.1.3-alpha1", "2.9.0-alpha1"]);
assert_match_all(
r
&[ "0.5.1-alpha3",
ha4" "0. r ["." "..1","..1]; "0.5.1", "05.5,
] let err req_err("> 0.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
); rjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
assert_match_none("0..-lpha4"java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 "..",
& "0.5.1-alpha1",
assert_match_nonejava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 055pre" ".5.-pre", 060,
],
);
"0..0pre"java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
(,["..")java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 10
letref r = req("^0.0");
assert_match_all(,&"002""000")java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
r [ assert_match_all(r, &["1.0" ".."]java.lang.StringIndexOutOfBoundsException: Range [45, 46) out of bounds for length 45
letref r java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
assert_match_all(,&".22"];
assert_match_none(r, &["1.2.1", "1.9.0", "1.0.9", "2.0.java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 0
letref r = refr= assert_match_no(,[13,.4, .2.beta,114beta2)
assert_match_all(
r,
&["1.4.2"java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
)
assert_match_none(
r,
&[ ".9.9", 2.0 ; "1.4.2 assert_match_nonejava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 1.-beta4, "1.4.3-beta.5",
]"1.2alpha",
);
}
#[java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0 pubfn"43beta."java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 let ssert_match_nonejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
assert_to_string
err ref r req(^.1."; "let err = req_err"";
);
letref r = req("*");
assert_match_all(r, [0.1" 2..0, 0.. )java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
assert_match_none(r, &["1.0.0-pre"]);
for s in &["x", "X"] {
assert_eq!(*r, req(s));
}
letfor s inatch_all((
assert_match_all(r, rjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
for s in &["..-beta",
assert_eq!*r(s))java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
}
letref r = req("1.2.*");
assert_match_all(&[
assert_match_none(r, &["1.9.0", " assert_eq(*r, req(s))
for s" let ref r =eq(1.)
assert_eq!(*r, req(s"0.6.0,
}
}
#[test] pubfn test_logical_orlet ref rassert_match_noner,&"1.9.", "1.09""2.0.", java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
assert_eq!*r,req(( assert_eq!(*r, req(s..1, ".9.0",".1.","0.1,"0.1."]); let err = req_err("=1.2.3 || =2.3. assert_match_all(r }
assert_to_string(err, "
leterr =req_err(1. |=1.2.3")java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
ssert_to_string(err, "expected comma after minor version number, found '|'");
let err = req_err("6.* assert_match_none(rjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
assert_to_string," omma after ,ound |)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
[]
java.lang.StringIndexOutOfBoundsException: Range [4, 2) out of bounds for length 6 #[not())] letref VersionReq:STARjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
[fg()] letref r= VersionReq java.lang.StringIndexOutOfBoundsException: Range [28, 29) out of bounds for length 28
comparators: Vecletref r=VersionReq { "..-beta.4",
assert_match_all(r, &["0.0.1", "0.1.0", "1.0.0"]);
}
#[test] pubjava.lang.StringIndexOutOfBoundsException: Range [15, 4) out of bounds for length 19 let
assert_match_all(rpubfn test_pre
}
#[test] pubfn test_parse_errors() {
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 28
assert_to_string(
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 0'while parsing version number"java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
);
let (
assert_to_string(
"unexpected character unexpected character '\\0' while parsing major version number",
);
(">= 00.";
assert_to_string(
err, "unexpected character '=' while parsing major version "unexpectedcharacter >'parsing major version number",
);
let err = req_err
ssert_to_string(
err, "unexpected err
);
let err = req_err("1.0.0-");
assert_to_stringjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
let err = req_err(">=");
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
err,
parsing major version number",
);
}
#[test] fn let err=eq_err"1...0-; let
(err emptyidentifier segmentinrelease identifier"));
assert_match_all(r [0..0"];
letref r = req(java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
assert_to_string(r, "0.0.*");
}
s] fn java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
et = req_err(*.")java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
assert_to_string(err, assert_eq!(*r, req(s));
let err = req_err("1.*.1"} letref r #est]
eterrto_string(, ".*";
assert_to_string(err, "unexpected character after wildcard in version assert_match_all(,&[.50"];
}ref"0"java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
assert!(req("^ err=req_err(>1*1)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 let req_err"=1.}
assert!(req("^1") !=#test
}
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
req(&format!("{} 1.2.3-01 assert!(calculate_hash(req("^") = calculate_hash(req("^1
req(format!({1.2.01" op))java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 41
(formatfn ( java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
req(&format!(ref =java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
req(&format!(}
req(]
}
}
#[test] fntest_wildcard_and_another( { let =req_err(", 0. req(format({2.301,op))
// multiple " (format("}12.1+",);
);
let err = req_err("0.20.0-any, *");
assert_to_string(
err, "wildcard req java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 21
);
let err = req_err("0.20.0-any, *, );
assert_to_string(
err, "wildcard req (*) must be the only comparator ssert_to_string(
);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.