History

[pack-gen] the first green test for Tag iterators

Sebastian Thiel committed 5 years ago

Commit df5ef8a1 parent 18983197 files · +230 −30Browse files

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

Unified · Split

git-object/tests/immutable/commit.rs+19−19
@@ -137,7 +137,7 @@ mod method { · 136 unmodified lines
137 use pretty_assertions::assert_eq;137 use pretty_assertions::assert_eq;
138 138
139 #[test]139 #[test]
140 fn tree() -> Result<(), Box<dyn std::error::Error>> {140 fn tree() -> crate::Result {
141 let fixture = fixture_bytes("commit", "unsigned.txt");141 let fixture = fixture_bytes("commit", "unsigned.txt");
142 let commit = Commit::from_bytes(&fixture)?;142 let commit = Commit::from_bytes(&fixture)?;
143 assert_eq!(commit.tree(), hex_to_id("1b2dfb4ac5e42080b682fc676e9738c94ce6d54d"));143 assert_eq!(commit.tree(), hex_to_id("1b2dfb4ac5e42080b682fc676e9738c94ce6d54d"));
@@ -157,7 +157,7 @@ mod iter { · 13 unmodified lines
157 use git_object::{bstr::ByteSlice, immutable::commit::iter::Token, immutable::CommitIter};157 use git_object::{bstr::ByteSlice, immutable::commit::iter::Token, immutable::CommitIter};
158 158
159 #[test]159 #[test]
160 fn newline_right_after_signature_multiline_header() -> Result<(), Box<dyn std::error::Error>> {160 fn newline_right_after_signature_multiline_header() -> crate::Result {
161 let data = fixture_bytes("commit", "signed-whitespace.txt");161 let data = fixture_bytes("commit", "signed-whitespace.txt");
162 let tokens = CommitIter::from_bytes(&data).collect::<Result<Vec<_>, _>>()?;162 let tokens = CommitIter::from_bytes(&data).collect::<Result<Vec<_>, _>>()?;
163 assert_eq!(tokens.len(), 7, "mainly a parsing exercise");163 assert_eq!(tokens.len(), 7, "mainly a parsing exercise");
@@ -171,7 +171,7 @@ mod iter { · 7 unmodified lines
171 }171 }
172 172
173 #[test]173 #[test]
174 fn signed_with_encoding() -> Result<(), Box<dyn std::error::Error>> {174 fn signed_with_encoding() -> crate::Result {
175 assert_eq!(175 assert_eq!(
176 CommitIter::from_bytes(&fixture_bytes("commit", "signed-with-encoding.txt"))176 CommitIter::from_bytes(&fixture_bytes("commit", "signed-with-encoding.txt"))
177 .collect::<Result<Vec<_>, _>>()?,177 .collect::<Result<Vec<_>, _>>()?,
@@ -197,7 +197,7 @@ mod iter { · 19 unmodified lines
197 }197 }
198 198
199 #[test]199 #[test]
200 fn whitespace() -> Result<(), Box<dyn std::error::Error>> {200 fn whitespace() -> crate::Result {
201 assert_eq!(201 assert_eq!(
202 CommitIter::from_bytes(&fixture_bytes("commit", "whitespace.txt")).collect::<Result<Vec<_>, _>>()?,202 CommitIter::from_bytes(&fixture_bytes("commit", "whitespace.txt")).collect::<Result<Vec<_>, _>>()?,
203 vec![203 vec![
@@ -220,7 +220,7 @@ mod iter { · 16 unmodified lines
220 }220 }
221 221
222 #[test]222 #[test]
223 fn unsigned() -> Result<(), Box<dyn std::error::Error>> {223 fn unsigned() -> crate::Result {
224 assert_eq!(224 assert_eq!(
225 CommitIter::from_bytes(&fixture_bytes("commit", "unsigned.txt")).collect::<Result<Vec<_>, _>>()?,225 CommitIter::from_bytes(&fixture_bytes("commit", "unsigned.txt")).collect::<Result<Vec<_>, _>>()?,
226 vec![226 vec![
@@ -240,7 +240,7 @@ mod iter { · 13 unmodified lines
240 }240 }
241 241
242 #[test]242 #[test]
243 fn signed_singleline() -> Result<(), Box<dyn std::error::Error>> {243 fn signed_singleline() -> crate::Result {
244 assert_eq!(244 assert_eq!(
245 CommitIter::from_bytes(&fixture_bytes("commit", "signed-singleline.txt")).collect::<Result<Vec<_>, _>>()?,245 CommitIter::from_bytes(&fixture_bytes("commit", "signed-singleline.txt")).collect::<Result<Vec<_>, _>>()?,
246 vec![246 vec![
@@ -264,7 +264,7 @@ mod iter { · 17 unmodified lines
264 }264 }
265 265
266 #[test]266 #[test]
267 fn error_handling() -> Result<(), Box<dyn std::error::Error>> {267 fn error_handling() -> crate::Result {
268 let data = fixture_bytes("commit", "unsigned.txt");268 let data = fixture_bytes("commit", "unsigned.txt");
269 let iter = CommitIter::from_bytes(&data[..data.len() / 2]);269 let iter = CommitIter::from_bytes(&data[..data.len() / 2]);
270 let tokens = iter.collect::<Vec<_>>();270 let tokens = iter.collect::<Vec<_>>();
@@ -276,7 +276,7 @@ mod iter { · 5 unmodified lines
276 }276 }
277 277
278 #[test]278 #[test]
279 fn mergetag() -> Result<(), Box<dyn std::error::Error>> {279 fn mergetag() -> crate::Result {
280 assert_eq!(280 assert_eq!(
281 CommitIter::from_bytes(&fixture_bytes("commit", "mergetag.txt")).collect::<Result<Vec<_>, _>>()?,281 CommitIter::from_bytes(&fixture_bytes("commit", "mergetag.txt")).collect::<Result<Vec<_>, _>>()?,
282 vec![282 vec![
@@ -310,7 +310,7 @@ mod iter { · 27 unmodified lines
310 use git_object::immutable::CommitIter;310 use git_object::immutable::CommitIter;
311 311
312 #[test]312 #[test]
313 fn tree_id() -> Result<(), Box<dyn std::error::Error>> {313 fn tree_id() -> crate::Result {
314 assert_eq!(314 assert_eq!(
315 CommitIter::from_bytes(&fixture_bytes("commit", "unsigned.txt")).tree_id(),315 CommitIter::from_bytes(&fixture_bytes("commit", "unsigned.txt")).tree_id(),
316 Some(hex_to_id("1b2dfb4ac5e42080b682fc676e9738c94ce6d54d"))316 Some(hex_to_id("1b2dfb4ac5e42080b682fc676e9738c94ce6d54d"))
@@ -325,7 +325,7 @@ mod iter { · 8 unmodified lines
325 }325 }
326 326
327 #[test]327 #[test]
328 fn signatures() -> Result<(), Box<dyn std::error::Error>> {328 fn signatures() -> crate::Result {
329 assert_eq!(329 assert_eq!(
330 CommitIter::from_bytes(&fixture_bytes("commit", "unsigned.txt"))330 CommitIter::from_bytes(&fixture_bytes("commit", "unsigned.txt"))
331 .signatures()331 .signatures()
@@ -346,7 +346,7 @@ mod from_bytes { · 14 unmodified lines
346 use smallvec::SmallVec;346 use smallvec::SmallVec;
347 347
348 #[test]348 #[test]
349 fn unsigned() -> Result<(), Box<dyn std::error::Error>> {349 fn unsigned() -> crate::Result {
350 assert_eq!(350 assert_eq!(
351 Commit::from_bytes(&fixture_bytes("commit", "unsigned.txt"))?,351 Commit::from_bytes(&fixture_bytes("commit", "unsigned.txt"))?,
352 Commit {352 Commit {
@@ -363,7 +363,7 @@ mod from_bytes { · 10 unmodified lines
363 }363 }
364 364
365 #[test]365 #[test]
366 fn whitespace() -> Result<(), Box<dyn std::error::Error>> {366 fn whitespace() -> crate::Result {
367 assert_eq!(367 assert_eq!(
368 Commit::from_bytes(&fixture_bytes("commit", "whitespace.txt"))?,368 Commit::from_bytes(&fixture_bytes("commit", "whitespace.txt"))?,
369 Commit {369 Commit {
@@ -380,7 +380,7 @@ mod from_bytes { · 10 unmodified lines
380 }380 }
381 381
382 #[test]382 #[test]
383 fn signed_singleline() -> Result<(), Box<dyn std::error::Error>> {383 fn signed_singleline() -> crate::Result {
384 assert_eq!(384 assert_eq!(
385 Commit::from_bytes(&fixture_bytes("commit", "signed-singleline.txt"))?,385 Commit::from_bytes(&fixture_bytes("commit", "signed-singleline.txt"))?,
386 Commit {386 Commit {
@@ -397,7 +397,7 @@ mod from_bytes { · 10 unmodified lines
397 }397 }
398 398
399 #[test]399 #[test]
400 fn mergetag() -> Result<(), Box<dyn std::error::Error>> {400 fn mergetag() -> crate::Result {
401 let fixture = fixture_bytes("commit", "mergetag.txt");401 let fixture = fixture_bytes("commit", "mergetag.txt");
402 let commit = Commit {402 let commit = Commit {
403 tree: b"1c61918031bf2c7fab9e17dde3c52a6a9884fcb5".as_bstr(),403 tree: b"1c61918031bf2c7fab9e17dde3c52a6a9884fcb5".as_bstr(),
@@ -421,7 +421,7 @@ mod from_bytes { · 17 unmodified lines
421 }421 }
422 422
423 #[test]423 #[test]
424 fn signed() -> Result<(), Box<dyn std::error::Error>> {424 fn signed() -> crate::Result {
425 assert_eq!(425 assert_eq!(
426 Commit::from_bytes(&fixture_bytes("commit", "signed.txt"))?,426 Commit::from_bytes(&fixture_bytes("commit", "signed.txt"))?,
427 Commit {427 Commit {
@@ -438,7 +438,7 @@ mod from_bytes { · 10 unmodified lines
438 }438 }
439 439
440 #[test]440 #[test]
441 fn signed_with_encoding() -> Result<(), Box<dyn std::error::Error>> {441 fn signed_with_encoding() -> crate::Result {
442 assert_eq!(442 assert_eq!(
443 Commit::from_bytes(&fixture_bytes("commit", "signed-with-encoding.txt"))?,443 Commit::from_bytes(&fixture_bytes("commit", "signed-with-encoding.txt"))?,
444 Commit {444 Commit {
@@ -455,7 +455,7 @@ mod from_bytes { · 10 unmodified lines
455 }455 }
456 456
457 #[test]457 #[test]
458 fn with_encoding() -> Result<(), Box<dyn std::error::Error>> {458 fn with_encoding() -> crate::Result {
459 assert_eq!(459 assert_eq!(
460 Commit::from_bytes(&fixture_bytes("commit", "with-encoding.txt"))?,460 Commit::from_bytes(&fixture_bytes("commit", "with-encoding.txt"))?,
461 Commit {461 Commit {
@@ -472,7 +472,7 @@ mod from_bytes { · 10 unmodified lines
472 }472 }
473 473
474 #[test]474 #[test]
475 fn merge() -> Result<(), Box<dyn std::error::Error>> {475 fn merge() -> crate::Result {
476 assert_eq!(476 assert_eq!(
477 Commit::from_bytes(&fixture_bytes("commit", "merge.txt"))?,477 Commit::from_bytes(&fixture_bytes("commit", "merge.txt"))?,
478 Commit {478 Commit {
@@ -504,7 +504,7 @@ iyBBl69jASy41Ug/BlFJbw4+ItkShpXwkJKuBBV/JExChmvbxYWaS7QnyYC9UO0= · 25 unmodified lines
504";504";
505 505
506 #[test]506 #[test]
507 fn newline_right_after_signature_multiline_header() -> Result<(), Box<dyn std::error::Error>> {507 fn newline_right_after_signature_multiline_header() -> crate::Result {
508 let fixture = fixture_bytes("commit", "signed-whitespace.txt");508 let fixture = fixture_bytes("commit", "signed-whitespace.txt");
509 let commit = Commit::from_bytes(&fixture)?;509 let commit = Commit::from_bytes(&fixture)?;
510 let pgp_sig = OTHER_SIGNATURE.as_bstr();510 let pgp_sig = OTHER_SIGNATURE.as_bstr();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t