summaryrefslogtreecommitdiff
path: root/semver/tests/deprecation.rs
blob: a5f533a3495bdfcb9781fea5548b239cc56692d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
extern crate semver;

#[test]
fn test_regressions() {
    use semver::VersionReq;
    use semver::ReqParseError;

    let versions = vec![
        (".*", VersionReq::any()),
        ("0.1.0.", VersionReq::parse("0.1.0").unwrap()),
        ("0.3.1.3", VersionReq::parse("0.3.13").unwrap()),
        ("0.2*", VersionReq::parse("0.2.*").unwrap()),
        ("*.0", VersionReq::any()),
    ];

    for (version, requirement) in versions.into_iter() {
        let parsed = VersionReq::parse(version);
        let error = parsed.err().unwrap();

        assert_eq!(ReqParseError::DeprecatedVersionRequirement(requirement), error);
    }
}