History

Another test for footer separation, simple version (#198)

Sebastian Thiel committed 5 years ago

Commit b4391861 parent 35313b92 files · +78 −0Browse files

Showing the changes to git-object/tests/immutable/commit (1 of 2 files). Show all

Unified · Split

git-object/tests/immutable/commit/from_bytes.rs+56−0
@@ -5,6 +5,7 @@ use crate::immutable::{ · 4 unmodified lines
5 commit::{LONG_MESSAGE, MERGE_TAG, SIGNATURE},5 commit::{LONG_MESSAGE, MERGE_TAG, SIGNATURE},
6 fixture_bytes, linus_signature, signature,6 fixture_bytes, linus_signature, signature,
7};7};
8use git_actor::{Sign, SignatureRef, Time};
8 9
9#[test]10#[test]
10fn unsigned() -> crate::Result {11fn unsigned() -> crate::Result {
@@ -132,6 +133,61 @@ fn with_encoding() -> crate::Result { · 121 unmodified lines
132 Ok(())133 Ok(())
133}134}
134 135
136#[test]
137fn with_footer() -> crate::Result {
138 let kim = SignatureRef {
139 name: "Kim Altintop".into(),
140 email: "kim@eagain.st".into(),
141 time: Time {
142 time: 1631514803,
143 offset: 7200,
144 sign: Sign::Plus,
145 },
146 };
147 let backing = fixture_bytes("commit", "message-with-footer.txt");
148 let commit = CommitRef::from_bytes(&backing)?;
149 assert_eq!(
150 commit,
151 CommitRef {
152 tree: b"25a19c29c5e36884c1ad85d8faf23f1246b7961b".as_bstr(),
153 parents: SmallVec::from(vec![b"699ae71105dddfcbb9711ed3a92df09e91a04e90".as_bstr()]),
154 author: kim.clone(),
155 committer: kim,
156 encoding: None,
157 message: b"test: use gitoxide for link-git-protocol tests
158
159Showcases the abilities of the `git-repository` crate, and standardises
160on using the re-exports through this crate for [stability] reasons
161instead of depending directly on the lower-level crates.
162
163[stability]: https://github.com/Byron/gitoxide/blob/main/STABILITY.md
164
165Signed-off-by: Sebastian Thiel <sebastian.thiel@icloud.com>
166Signed-off-by: Kim Altintop <kim@eagain.st>"
167 .as_bstr(),
168 extra_headers: vec![(b"gpgsig".as_bstr(), b"-----BEGIN PGP SIGNATURE-----\n\niHUEABYIAB0WIQSuZwcGWSQItmusNgR5URpSUCnwXQUCYT7xpAAKCRB5URpSUCnw\nXWB3AP9q323HlxnI8MyqszNOeYDwa7Y3yEZaUM2y/IRjz+z4YQEAq0yr1Syt3mrK\nOSFCqL2vDm3uStP+vF31f6FnzayhNg0=\n=Mhpp\n-----END PGP SIGNATURE-----".as_bstr().into())]
169 }
170 );
171 let message = commit.message();
172 assert_eq!(message.title, "test: use gitoxide for link-git-protocol tests");
173 assert_eq!(
174 message.body,
175 Some(
176 "Showcases the abilities of the `git-repository` crate, and standardises
177on using the re-exports through this crate for [stability] reasons
178instead of depending directly on the lower-level crates.
179
180[stability]: https://github.com/Byron/gitoxide/blob/main/STABILITY.md
181
182Signed-off-by: Sebastian Thiel <sebastian.thiel@icloud.com>
183Signed-off-by: Kim Altintop <kim@eagain.st>"
184 .into()
185 )
186 );
187 // let body = message.body();
188 Ok(())
189}
190
135#[test]191#[test]
136fn merge() -> crate::Result {192fn merge() -> crate::Result {
137 assert_eq!(193 assert_eq!(