11//! Tests for local-registry sources.
22
3- #![ allow( deprecated) ]
4-
53use cargo_test_support:: paths:: { self , CargoPathExt } ;
4+ use cargo_test_support:: prelude:: * ;
65use cargo_test_support:: registry:: { registry_path, Package } ;
7- use cargo_test_support:: { basic_manifest, project, t} ;
6+ use cargo_test_support:: { basic_manifest, project, str , t} ;
87use std:: fs;
98
109fn setup ( ) {
@@ -52,17 +51,21 @@ fn simple() {
5251 . build ( ) ;
5352
5453 p. cargo ( "build" )
55- . with_stderr (
56- "\
54+ . with_stderr_data ( str![ [ r#"
5755[LOCKING] 2 packages to latest compatible versions
58- [UNPACKING] bar v0.0.1 ([..] )
56+ [UNPACKING] bar v0.0.1 (registry `[ROOT]/registry` )
5957[COMPILING] bar v0.0.1
60- [COMPILING] foo v0.0.1 ([CWD])
61- [FINISHED] [..]
62- " ,
63- )
58+ [COMPILING] foo v0.0.1 ([ROOT]/foo)
59+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
60+
61+ "# ] ] )
62+ . run ( ) ;
63+ p. cargo ( "build" )
64+ . with_stderr_data ( str![ [ r#"
65+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
66+
67+ "# ] ] )
6468 . run ( ) ;
65- p. cargo ( "build" ) . with_stderr ( "[FINISHED] [..]" ) . run ( ) ;
6669 p. cargo ( "test" ) . run ( ) ;
6770}
6871
@@ -95,13 +98,12 @@ fn not_found() {
9598
9699 p. cargo ( "check" )
97100 . with_status ( 101 )
98- . with_stderr (
99- "\
101+ . with_stderr_data ( str![ [ r#"
100102[ERROR] no matching package named `baz` found
101103location searched: registry `crates-io`
102- required by package `foo v0.0.1 ([.. ]/foo)`
103- " ,
104- )
104+ required by package `foo v0.0.1 ([ROOT ]/foo)`
105+
106+ "# ] ] )
105107 . run ( ) ;
106108}
107109
@@ -137,11 +139,10 @@ fn depend_on_yanked() {
137139 . publish ( ) ;
138140
139141 p. cargo ( "check" )
140- . with_stderr (
141- "\
142- [FINISHED] [..]
143- " ,
144- )
142+ . with_stderr_data ( str![ [ r#"
143+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
144+
145+ "# ] ] )
145146 . run ( ) ;
146147}
147148
@@ -175,15 +176,14 @@ fn multiple_versions() {
175176 . build ( ) ;
176177
177178 p. cargo ( "check" )
178- . with_stderr (
179- "\
179+ . with_stderr_data ( str![ [ r#"
180180[LOCKING] 2 packages to latest compatible versions
181- [UNPACKING] bar v0.1.0 ([..] )
181+ [UNPACKING] bar v0.1.0 (registry `[ROOT]/registry` )
182182[CHECKING] bar v0.1.0
183- [CHECKING] foo v0.0.1 ([CWD] )
184- [FINISHED] [..]
185- " ,
186- )
183+ [CHECKING] foo v0.0.1 ([ROOT]/foo )
184+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
185+
186+ "# ] ] )
187187 . run ( ) ;
188188
189189 Package :: new ( "bar" , "0.2.0" )
@@ -192,11 +192,11 @@ fn multiple_versions() {
192192 . publish ( ) ;
193193
194194 p. cargo ( "update" )
195- . with_stderr (
196- "\
195+ . with_stderr_data ( str![ [ r#"
197196[LOCKING] 1 package to latest compatible version
198- [UPDATING] bar v0.1.0 -> v0.2.0" ,
199- )
197+ [UPDATING] bar v0.1.0 -> v0.2.0
198+
199+ "# ] ] )
200200 . run ( ) ;
201201}
202202
@@ -241,16 +241,18 @@ fn multiple_names() {
241241 . build ( ) ;
242242
243243 p. cargo ( "check" )
244- . with_stderr (
245- " \
244+ . with_stderr_data (
245+ str! [ [ r#"
246246[LOCKING] 3 packages to latest compatible versions
247- [UNPACKING] [..]
248- [UNPACKING] [..]
249- [CHECKING] [..]
250- [CHECKING] [..]
251- [CHECKING] foo v0.0.1 ([CWD])
252- [FINISHED] [..]
253- " ,
247+ [UNPACKING] bar v0.0.1 (registry `[ROOT]/registry`)
248+ [UNPACKING] baz v0.1.0 (registry `[ROOT]/registry`)
249+ [CHECKING] bar v0.0.1
250+ [CHECKING] baz v0.1.0
251+ [CHECKING] foo v0.0.1 ([ROOT]/foo)
252+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
253+
254+ "# ] ]
255+ . unordered ( ) ,
254256 )
255257 . run ( ) ;
256258}
@@ -297,17 +299,16 @@ fn interdependent() {
297299 . build ( ) ;
298300
299301 p. cargo ( "check" )
300- . with_stderr (
301- "\
302+ . with_stderr_data ( str![ [ r#"
302303[LOCKING] 3 packages to latest compatible versions
303- [UNPACKING] [..]
304- [UNPACKING] [..]
304+ [UNPACKING] bar v0.0.1 (registry `[ROOT]/registry`)
305+ [UNPACKING] baz v0.1.0 (registry `[ROOT]/registry`)
305306[CHECKING] bar v0.0.1
306307[CHECKING] baz v0.1.0
307- [CHECKING] foo v0.0.1 ([CWD] )
308- [FINISHED] [..]
309- " ,
310- )
308+ [CHECKING] foo v0.0.1 ([ROOT]/foo )
309+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
310+
311+ "# ] ] )
311312 . run ( ) ;
312313}
313314
@@ -368,17 +369,16 @@ fn path_dep_rewritten() {
368369 . build ( ) ;
369370
370371 p. cargo ( "check" )
371- . with_stderr (
372- "\
372+ . with_stderr_data ( str![ [ r#"
373373[LOCKING] 3 packages to latest compatible versions
374- [UNPACKING] [..]
375- [UNPACKING] [..]
374+ [UNPACKING] bar v0.0.1 (registry `[ROOT]/registry`)
375+ [UNPACKING] baz v0.1.0 (registry `[ROOT]/registry`)
376376[CHECKING] bar v0.0.1
377377[CHECKING] baz v0.1.0
378- [CHECKING] foo v0.0.1 ([CWD] )
379- [FINISHED] [..]
380- " ,
381- )
378+ [CHECKING] foo v0.0.1 ([ROOT]/foo )
379+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
380+
381+ "# ] ] )
382382 . run ( ) ;
383383}
384384
@@ -415,9 +415,8 @@ fn invalid_dir_bad() {
415415
416416 p. cargo ( "check" )
417417 . with_status ( 101 )
418- . with_stderr (
419- "\
420- [ERROR] failed to get `bar` as a dependency of package `foo v0.0.1 [..]`
418+ . with_stderr_data ( str![ [ r#"
419+ [ERROR] failed to get `bar` as a dependency of package `foo v0.0.1 ([ROOT]/foo)`
421420
422421Caused by:
423422 failed to load source for dependency `bar`
@@ -430,8 +429,8 @@ Caused by:
430429
431430Caused by:
432431 local registry path is not a directory: [..]path[..]to[..]nowhere
433- " ,
434- )
432+
433+ "# ] ] )
435434 . run ( ) ;
436435}
437436
@@ -478,8 +477,7 @@ fn different_directory_replacing_the_registry_is_bad() {
478477
479478 p. cargo ( "check" )
480479 . with_status ( 101 )
481- . with_stderr (
482- "\
480+ . with_stderr_data ( str![ [ r#"
483481[ERROR] checksum for `bar v0.0.1` changed between lock files
484482
485483this could be indicative of a few possible errors:
@@ -490,8 +488,8 @@ this could be indicative of a few possible errors:
490488
491489unable to verify that `bar v0.0.1` is the same as when the lockfile was generated
492490
493- " ,
494- )
491+
492+ "# ] ] )
495493 . run ( ) ;
496494}
497495
@@ -536,16 +534,20 @@ fn crates_io_registry_url_is_optional() {
536534 . build ( ) ;
537535
538536 p. cargo ( "build" )
539- . with_stderr (
540- "\
537+ . with_stderr_data ( str![ [ r#"
541538[LOCKING] 2 packages to latest compatible versions
542- [UNPACKING] bar v0.0.1 ([..] )
539+ [UNPACKING] bar v0.0.1 (registry `[ROOT]/registry` )
543540[COMPILING] bar v0.0.1
544- [COMPILING] foo v0.0.1 ([CWD])
545- [FINISHED] [..]
546- " ,
547- )
541+ [COMPILING] foo v0.0.1 ([ROOT]/foo)
542+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
543+
544+ "# ] ] )
545+ . run ( ) ;
546+ p. cargo ( "build" )
547+ . with_stderr_data ( str![ [ r#"
548+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
549+
550+ "# ] ] )
548551 . run ( ) ;
549- p. cargo ( "build" ) . with_stderr ( "[FINISHED] [..]" ) . run ( ) ;
550552 p. cargo ( "test" ) . run ( ) ;
551553}
0 commit comments