78
78
}
79
79
80
80
/// Check the `cargo publish` API call
81
+ #[ track_caller]
81
82
pub fn validate_upload ( expected_json : & str , expected_crate_name : & str , expected_files : & [ & str ] ) {
82
83
let new_path = registry:: api_path ( ) . join ( "api/v1/crates/new" ) ;
83
84
_validate_upload (
@@ -90,6 +91,7 @@ pub fn validate_upload(expected_json: &str, expected_crate_name: &str, expected_
90
91
}
91
92
92
93
/// Check the `cargo publish` API call, with file contents
94
+ #[ track_caller]
93
95
pub fn validate_upload_with_contents (
94
96
expected_json : & str ,
95
97
expected_crate_name : & str ,
@@ -107,6 +109,7 @@ pub fn validate_upload_with_contents(
107
109
}
108
110
109
111
/// Check the `cargo publish` API call to the alternative test registry
112
+ #[ track_caller]
110
113
pub fn validate_alt_upload (
111
114
expected_json : & str ,
112
115
expected_crate_name : & str ,
@@ -122,6 +125,7 @@ pub fn validate_alt_upload(
122
125
) ;
123
126
}
124
127
128
+ #[ track_caller]
125
129
fn _validate_upload (
126
130
new_path : & Path ,
127
131
expected_json : & str ,
@@ -142,6 +146,7 @@ fn _validate_upload(
142
146
) ;
143
147
}
144
148
149
+ #[ track_caller]
145
150
fn read_new_post ( new_path : & Path ) -> ( Vec < u8 > , Vec < u8 > ) {
146
151
let mut f = File :: open ( new_path) . unwrap ( ) ;
147
152
@@ -170,6 +175,7 @@ fn read_new_post(new_path: &Path) -> (Vec<u8>, Vec<u8>) {
170
175
/// - `expected_contents` should be a list of `(file_name, contents)` tuples
171
176
/// to validate the contents of the given file. Only the listed files will
172
177
/// be checked (others will be ignored).
178
+ #[ track_caller]
173
179
pub fn validate_crate_contents (
174
180
reader : impl Read ,
175
181
expected_crate_name : & str ,
@@ -185,17 +191,19 @@ pub fn validate_crate_contents(
185
191
)
186
192
}
187
193
194
+ #[ track_caller]
188
195
fn validate_crate_contents_ (
189
196
reader : impl Read ,
190
197
expected_crate_name : & str ,
191
198
expected_files : & [ & str ] ,
192
199
expected_contents : InMemoryDir ,
193
200
) {
194
201
let mut rdr = GzDecoder :: new ( reader) ;
195
- assert_eq ! (
196
- rdr. header( ) . unwrap( ) . filename( ) . unwrap( ) ,
197
- expected_crate_name. as_bytes( )
198
- ) ;
202
+ snapbox:: assert_data_eq!( rdr. header( ) . unwrap( ) . filename( ) . unwrap( ) , {
203
+ let expected: snapbox:: Data = expected_crate_name. into( ) ;
204
+ expected. raw( )
205
+ } ) ;
206
+
199
207
let mut contents = Vec :: new ( ) ;
200
208
rdr. read_to_end ( & mut contents) . unwrap ( ) ;
201
209
let mut ar = Archive :: new ( & contents[ ..] ) ;
0 commit comments