2017-01-30 17:38:11 +00:00
|
|
|
import pytest
|
|
|
|
|
2017-02-19 11:10:16 +00:00
|
|
|
import rust2rpm
|
2017-02-05 20:06:40 +00:00
|
|
|
|
2018-10-26 09:20:13 +00:00
|
|
|
@pytest.mark.parametrize("req, rpmdep", [
|
|
|
|
("^1.2.3",
|
|
|
|
"(crate(test) >= 1.2.3 with crate(test) < 2.0.0)"),
|
|
|
|
("^1.2",
|
|
|
|
"(crate(test) >= 1.2.0 with crate(test) < 2.0.0)"),
|
|
|
|
("^1",
|
2017-02-19 11:10:16 +00:00
|
|
|
"(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"),
|
2018-10-26 09:20:13 +00:00
|
|
|
("^0.2.3",
|
|
|
|
"(crate(test) >= 0.2.3 with crate(test) < 0.3.0)"),
|
|
|
|
("^0.2",
|
|
|
|
"(crate(test) >= 0.2.0 with crate(test) < 0.3.0)"),
|
|
|
|
("^0.0.3",
|
|
|
|
"(crate(test) >= 0.0.3 with crate(test) < 0.0.4)"),
|
|
|
|
("^0.0",
|
|
|
|
"(crate(test) >= 0.0.0 with crate(test) < 0.1.0)"),
|
|
|
|
("^0",
|
|
|
|
"(crate(test) >= 0.0.0 with crate(test) < 1.0.0)"),
|
|
|
|
("~1.2.3",
|
|
|
|
"(crate(test) >= 1.2.3 with crate(test) < 1.3.0)"),
|
|
|
|
("~1.2",
|
|
|
|
"(crate(test) >= 1.2.0 with crate(test) < 1.3.0)"),
|
|
|
|
("~1",
|
|
|
|
"(crate(test) >= 1.0.0 with crate(test) < 2.0.0)"),
|
|
|
|
("*",
|
|
|
|
"crate(test)"),
|
|
|
|
(">= 1.2.0",
|
|
|
|
"crate(test) >= 1.2.0"),
|
|
|
|
("> 1",
|
|
|
|
"crate(test) > 1.0.0"),
|
|
|
|
("< 2",
|
|
|
|
"crate(test) < 2.0.0"),
|
|
|
|
("= 1.2.3",
|
|
|
|
"crate(test) = 1.2.3"),
|
|
|
|
(">= 1.2, < 1.5",
|
|
|
|
"(crate(test) >= 1.2.0 with crate(test) < 1.5.0)"),
|
2017-02-19 11:10:16 +00:00
|
|
|
])
|
2018-10-26 09:20:13 +00:00
|
|
|
def test_dependency(req, rpmdep):
|
|
|
|
dep = rust2rpm.Dependency("test", req)
|
2017-02-19 11:10:16 +00:00
|
|
|
assert str(dep) == rpmdep
|