7878}
7979
8080/// Check the `cargo publish` API call
81+ #[ track_caller]
8182pub fn validate_upload ( expected_json : & str , expected_crate_name : & str , expected_files : & [ & str ] ) {
8283 let new_path = registry:: api_path ( ) . join ( "api/v1/crates/new" ) ;
8384 _validate_upload (
@@ -90,6 +91,7 @@ pub fn validate_upload(expected_json: &str, expected_crate_name: &str, expected_
9091}
9192
9293/// Check the `cargo publish` API call, with file contents
94+ #[ track_caller]
9395pub fn validate_upload_with_contents (
9496 expected_json : & str ,
9597 expected_crate_name : & str ,
@@ -107,6 +109,7 @@ pub fn validate_upload_with_contents(
107109}
108110
109111/// Check the `cargo publish` API call to the alternative test registry
112+ #[ track_caller]
110113pub fn validate_alt_upload (
111114 expected_json : & str ,
112115 expected_crate_name : & str ,
@@ -122,6 +125,7 @@ pub fn validate_alt_upload(
122125 ) ;
123126}
124127
128+ #[ track_caller]
125129fn _validate_upload (
126130 new_path : & Path ,
127131 expected_json : & str ,
@@ -142,6 +146,7 @@ fn _validate_upload(
142146 ) ;
143147}
144148
149+ #[ track_caller]
145150fn read_new_post ( new_path : & Path ) -> ( Vec < u8 > , Vec < u8 > ) {
146151 let mut f = File :: open ( new_path) . unwrap ( ) ;
147152
@@ -170,6 +175,7 @@ fn read_new_post(new_path: &Path) -> (Vec<u8>, Vec<u8>) {
170175/// - `expected_contents` should be a list of `(file_name, contents)` tuples
171176/// to validate the contents of the given file. Only the listed files will
172177/// be checked (others will be ignored).
178+ #[ track_caller]
173179pub fn validate_crate_contents (
174180 reader : impl Read ,
175181 expected_crate_name : & str ,
@@ -185,17 +191,19 @@ pub fn validate_crate_contents(
185191 )
186192}
187193
194+ #[ track_caller]
188195fn validate_crate_contents_ (
189196 reader : impl Read ,
190197 expected_crate_name : & str ,
191198 expected_files : & [ & str ] ,
192199 expected_contents : InMemoryDir ,
193200) {
194201 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+
199207 let mut contents = Vec :: new ( ) ;
200208 rdr. read_to_end ( & mut contents) . unwrap ( ) ;
201209 let mut ar = Archive :: new ( & contents[ ..] ) ;
0 commit comments