mod connect_message {
use crate::{client::git, Protocol, Service};
#[test]
fn version_1_without_host_and_version() {
assert_eq!(
git::message::connect(Service::UploadPack, Protocol::V1, b"hello/world", None),
"git-upload-pack hello/world\0"
)
}
#[test]
fn version_2_without_host_and_version() {
assert_eq!(
git::message::connect(Service::UploadPack, Protocol::V2, b"hello\\world", None),
"git-upload-pack hello\\world\0\0version=2\0"
)
}
#[test]
fn with_host_without_port() {
assert_eq!(
git::message::connect(
Service::UploadPack,
Protocol::V1,
b"hello\\world",
Some(&("host".into(), None))
),
"git-upload-pack hello\\world\0host=host\0"
)
}
#[test]
fn with_host_with_port() {
assert_eq!(
git::message::connect(
Service::UploadPack,
Protocol::V1,
b"hello\\world",
Some(&("host".into(), Some(404)))
),
"git-upload-pack hello\\world\0host=host:404\0"
)
}
}