@@ -10,7 +10,7 @@ mod method {
10
10
use pretty_assertions:: assert_eq;
11
11
12
12
#[ test]
13
- fn target ( ) -> Result < ( ) , Box < dyn std :: error :: Error > > {
13
+ fn target ( ) -> crate :: Result {
14
14
let fixture = fixture_bytes ( "tag" , "signed.txt" ) ;
15
15
let tag = Tag :: from_bytes ( & fixture) ?;
16
16
assert_eq ! ( tag. target( ) , hex_to_id( "ffa700b4aca13b80cb6b98a078e7c96804f8e0ec" ) ) ;
@@ -28,7 +28,7 @@ mod iter {
28
28
} ;
29
29
30
30
#[ test]
31
- fn empty ( ) -> Result < ( ) , Box < dyn std :: error :: Error > > {
31
+ fn empty ( ) -> crate :: Result {
32
32
assert_eq ! (
33
33
TagIter :: from_bytes( & fixture_bytes( "tag" , "empty.txt" ) ) . collect:: <Result <Vec <_>, _>>( ) ?,
34
34
vec![
@@ -43,6 +43,62 @@ mod iter {
43
43
Ok ( ( ) )
44
44
}
45
45
46
+ #[ test]
47
+ fn no_tagger ( ) -> crate :: Result {
48
+ assert_eq ! (
49
+ TagIter :: from_bytes( & fixture_bytes( "tag" , "no-tagger.txt" ) ) . collect:: <Result <Vec <_>, _>>( ) ?,
50
+ vec![
51
+ Token :: Target {
52
+ id: hex_to_id( "c39ae07f393806ccf406ef966e9a15afc43cc36a" )
53
+ } ,
54
+ Token :: TargetKind ( Kind :: Tree ) ,
55
+ Token :: Name ( b"v2.6.11-tree" . as_bstr( ) ) ,
56
+ Token :: Tagger ( None ) ,
57
+ Token :: Body {
58
+ message: b"This is the 2.6.11 tree object.
59
+
60
+ NOTE! There's no commit for this, since it happened before I started with git.
61
+ Eventually we'll import some sort of history, and that should tie this tree
62
+ object up to a real commit. In the meantime, this acts as an anchor point for
63
+ doing diffs etc under git."
64
+ . as_bstr( ) ,
65
+ pgp_signature: Some (
66
+ b"-----BEGIN PGP SIGNATURE-----
67
+ Version: GnuPG v1.2.4 (GNU/Linux)
68
+
69
+ iD8DBQBCeV/eF3YsRnbiHLsRAl+SAKCVp8lVXwpUhMEvy8N5jVBd16UCmACeOtP6
70
+ KLMHist5yj0sw1E4hDTyQa0=
71
+ =/bIK
72
+ -----END PGP SIGNATURE-----
73
+ "
74
+ . as_bstr( )
75
+ )
76
+ }
77
+ ]
78
+ ) ;
79
+ Ok ( ( ) )
80
+ }
81
+
82
+ #[ test]
83
+ fn whitespace ( ) -> crate :: Result {
84
+ assert_eq ! (
85
+ TagIter :: from_bytes( & fixture_bytes( "tag" , "whitespace.txt" ) ) . collect:: <Result <Vec <_>, _>>( ) ?,
86
+ vec![
87
+ Token :: Target {
88
+ id: hex_to_id( "01dd4e2a978a9f5bd773dae6da7aa4a5ac1cdbbc" )
89
+ } ,
90
+ Token :: TargetKind ( Kind :: Commit ) ,
91
+ Token :: Name ( b"whitespace" . as_bstr( ) ) ,
92
+ Token :: Tagger ( Some ( signature( 1592382888 ) ) ) ,
93
+ Token :: Body {
94
+ message: b" \t tab\n newline\n \n last-with-trailer\n " . as_bstr( ) ,
95
+ pgp_signature: None
96
+ }
97
+ ]
98
+ ) ;
99
+ Ok ( ( ) )
100
+ }
101
+
46
102
#[ test]
47
103
fn error_handling ( ) -> crate :: Result {
48
104
let data = fixture_bytes ( "tag" , "empty.txt" ) ;
@@ -61,13 +117,13 @@ mod from_bytes {
61
117
use git_object:: { bstr:: ByteSlice , immutable:: Tag , Kind } ;
62
118
63
119
#[ test]
64
- fn signed ( ) -> Result < ( ) , Box < dyn std :: error :: Error > > {
120
+ fn signed ( ) -> crate :: Result {
65
121
assert_eq ! ( Tag :: from_bytes( & fixture_bytes( "tag" , "signed.txt" ) ) ?, tag_fixture( 9000 ) ) ;
66
122
Ok ( ( ) )
67
123
}
68
124
69
125
#[ test]
70
- fn empty ( ) -> Result < ( ) , Box < dyn std :: error :: Error > > {
126
+ fn empty ( ) -> crate :: Result {
71
127
assert_eq ! (
72
128
Tag :: from_bytes( & fixture_bytes( "tag" , "empty.txt" ) ) ?,
73
129
Tag {
@@ -83,7 +139,7 @@ mod from_bytes {
83
139
}
84
140
85
141
#[ test]
86
- fn with_newlines ( ) -> Result < ( ) , Box < dyn std :: error :: Error > > {
142
+ fn with_newlines ( ) -> crate :: Result {
87
143
assert_eq ! (
88
144
Tag :: from_bytes( & fixture_bytes( "tag" , "with-newlines.txt" ) ) ?,
89
145
Tag {
@@ -99,7 +155,7 @@ mod from_bytes {
99
155
}
100
156
101
157
#[ test]
102
- fn no_tagger ( ) -> Result < ( ) , Box < dyn std :: error :: Error > > {
158
+ fn no_tagger ( ) -> crate :: Result {
103
159
assert_eq ! (
104
160
Tag :: from_bytes( & fixture_bytes( "tag" , "no-tagger.txt" ) ) ?,
105
161
Tag {
@@ -131,14 +187,14 @@ KLMHist5yj0sw1E4hDTyQa0=
131
187
}
132
188
133
189
#[ test]
134
- fn whitespace ( ) -> Result < ( ) , Box < dyn std :: error :: Error > > {
190
+ fn whitespace ( ) -> crate :: Result {
135
191
assert_eq ! (
136
192
Tag :: from_bytes( & fixture_bytes( "tag" , "whitespace.txt" ) ) ?,
137
193
Tag {
138
194
target: b"01dd4e2a978a9f5bd773dae6da7aa4a5ac1cdbbc" . as_bstr( ) ,
139
195
name: b"whitespace" . as_bstr( ) ,
140
196
target_kind: Kind :: Commit ,
141
- message: b" \t tab\n newline\n \n last-with-trailer\n " . as_bstr( ) , // odd, was created with \n\n actually
197
+ message: b" \t tab\n newline\n \n last-with-trailer\n " . as_bstr( ) ,
142
198
tagger: Some ( signature( 1592382888 ) ) ,
143
199
pgp_signature: None
144
200
}
0 commit comments