1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
//! ref: composer/tests/Composer/Test/Package/RootAliasPackageTest.php
use indexmap::IndexMap;
use shirabe::package::{Link, RootAliasPackageHandle, RootPackageHandle};
use shirabe_semver::constraint::MatchAllConstraint;
fn links(link_type: &str) -> IndexMap<String, Link> {
let mut map: IndexMap<String, Link> = IndexMap::new();
map.insert(
"b".to_string(),
Link::new(
"a".to_string(),
"b".to_string(),
MatchAllConstraint::new(None).into(),
Some(link_type.to_string()),
"self.version".to_string(),
),
);
map
}
fn alias() -> RootAliasPackageHandle {
let root = RootPackageHandle::new(
"something/something".to_string(),
"1.0.0.0".to_string(),
"1.0".to_string(),
);
RootAliasPackageHandle::new(root, "1.0".to_string(), "1.0.0.0".to_string())
}
#[test]
fn test_update_requires() {
let alias = alias();
assert!(alias.get_requires().is_empty());
alias.set_requires(links(Link::TYPE_REQUIRE));
assert!(!alias.get_requires().is_empty());
}
#[test]
fn test_update_dev_requires() {
let alias = alias();
assert!(alias.get_dev_requires().is_empty());
alias.set_dev_requires(links(Link::TYPE_DEV_REQUIRE));
assert!(!alias.get_dev_requires().is_empty());
}
#[test]
fn test_update_conflicts() {
let alias = alias();
assert!(alias.get_conflicts().is_empty());
alias.set_conflicts(links(Link::TYPE_CONFLICT));
assert!(!alias.get_conflicts().is_empty());
}
#[test]
fn test_update_provides() {
let alias = alias();
assert!(alias.get_provides().is_empty());
alias.set_provides(links(Link::TYPE_PROVIDE));
assert!(!alias.get_provides().is_empty());
}
#[test]
fn test_update_replaces() {
let alias = alias();
assert!(alias.get_replaces().is_empty());
alias.set_replaces(links(Link::TYPE_REPLACE));
assert!(!alias.get_replaces().is_empty());
}
|