Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 31, 2020
1 parent 2da70f6 commit 88ecda1
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 7 deletions.
Empty file added git-protocol/tests/fetch/mod.rs
Empty file.
28 changes: 23 additions & 5 deletions git-transport/tests/client/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,31 @@ fn handshake_v1_and_request() -> crate::Result {
assert_eq!(
res.capabilities
.iter()
.flat_map(|c| c.value().map(ToOwned::to_owned))
.map(|c| (c.name().to_owned(), c.value().map(ToOwned::to_owned)))
.collect::<Vec<_>>(),
vec![
b"HEAD:refs/heads/master".as_bstr(),
b"sha1".as_bstr(),
b"git/2.28.0".as_bstr()
[
("multi_ack", None),
("thin-pack", None),
("side-band", None),
("side-band-64k", None),
("ofs-delta", None),
("shallow", None),
("deepen-since", None),
("deepen-not", None),
("deepen-relative", None),
("no-progress", None),
("include-tag", None),
("multi_ack_detailed", None),
("symref", Some("HEAD:refs/heads/master")),
("object-format", Some("sha1")),
("agent", Some("git/2.28.0"))
]
.iter()
.map(|(n, v)| (
n.as_bytes().as_bstr().to_owned(),
v.map(|v| v.as_bytes().as_bstr().to_owned())
))
.collect::<Vec<_>>()
);
let refs = res
.refs
Expand Down
29 changes: 27 additions & 2 deletions git-transport/tests/client/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,34 @@ fn handshake_v1() -> crate::Result {
assert_eq!(
capabilities
.iter()
.filter_map(|c| c.value().map(ToOwned::to_owned))
.map(|c| (c.name().to_owned(), c.value().map(ToOwned::to_owned)))
.collect::<Vec<_>>(),
vec![b"HEAD:refs/heads/main".as_bstr(), b"git/github-gdf51a71f0236".as_bstr(),]
[
("multi_ack", None),
("thin-pack", None),
("side-band", None),
("side-band-64k", None),
("ofs-delta", None),
("shallow", None),
("deepen-since", None),
("deepen-not", None),
("deepen-relative", None),
("no-progress", None),
("include-tag", None),
("multi_ack_detailed", None),
("allow-tip-sha1-in-want", None),
("allow-reachable-sha1-in-want", None),
("no-done", None),
("symref", Some("HEAD:refs/heads/main")),
("filter", None),
("agent", Some("git/github-gdf51a71f0236"))
]
.iter()
.map(|(n, v)| (
n.as_bytes().as_bstr().to_owned(),
v.map(|v| v.as_bytes().as_bstr().to_owned())
))
.collect::<Vec<_>>()
);
let refs = refs
.expect("v1 protocol provides refs")
Expand Down

0 comments on commit 88ecda1

Please sign in to comment.