File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,53 @@ directory = "vendor"
69
69
. run ( ) ;
70
70
}
71
71
72
+ #[ cargo_test]
73
+ fn vendor_path_specified ( ) {
74
+ let p = project ( )
75
+ . file (
76
+ "Cargo.toml" ,
77
+ r#"
78
+ [package]
79
+ name = "foo"
80
+ version = "0.1.0"
81
+
82
+ [dependencies]
83
+ log = "0.3.5"
84
+ "# ,
85
+ )
86
+ . file ( "src/lib.rs" , "" )
87
+ . build ( ) ;
88
+
89
+ Package :: new ( "log" , "0.3.5" ) . publish ( ) ;
90
+
91
+ let path = if cfg ! ( windows) {
92
+ r#"deps\.vendor"#
93
+ } else {
94
+ "deps/.vendor"
95
+ } ;
96
+
97
+ let output = p
98
+ . cargo ( "vendor --respect-source-config" )
99
+ . arg ( path)
100
+ . exec_with_output ( )
101
+ . unwrap ( ) ;
102
+ // Assert against original output to ensure that
103
+ // path is normalized by `ops::vendor` on Windows.
104
+ assert_eq ! (
105
+ & String :: from_utf8( output. stdout) . unwrap( ) ,
106
+ r#"
107
+ [source.crates-io]
108
+ replace-with = "vendored-sources"
109
+
110
+ [source.vendored-sources]
111
+ directory = "deps/.vendor"
112
+ "#
113
+ ) ;
114
+
115
+ let lock = p. read_file ( "deps/.vendor/log/Cargo.toml" ) ;
116
+ assert ! ( lock. contains( "version = \" 0.3.5\" " ) ) ;
117
+ }
118
+
72
119
fn add_vendor_config ( p : & Project ) {
73
120
p. change_file (
74
121
".cargo/config" ,
You can’t perform that action at this time.
0 commit comments