File tree 1 file changed +46
-0
lines changed
1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -184,3 +184,49 @@ fn target_triple_rustflags_works() {
184
184
. with_stderr_contains ( "[RUNNING] `rustdoc[..]--cfg[..]foo[..]`" )
185
185
. run ( ) ;
186
186
}
187
+
188
+ #[ cargo_test]
189
+ fn target_triple_rustdocflags_works_through_cargo_test ( ) {
190
+ let host = rustc_host ( ) ;
191
+ let host_env = rustc_host_env ( ) ;
192
+ let p = project ( )
193
+ . file (
194
+ "src/lib.rs" ,
195
+ r#"
196
+ //! ```
197
+ //! assert!(cfg!(foo));
198
+ //! ```
199
+ "# ,
200
+ )
201
+ . build ( ) ;
202
+
203
+ // target.triple.rustdocflags in env works
204
+ p. cargo ( "test --doc -v" )
205
+ . env (
206
+ & format ! ( "CARGO_TARGET_{host_env}_RUSTDOCFLAGS" ) ,
207
+ "--cfg=foo" ,
208
+ )
209
+ . with_stderr_contains ( "[RUNNING] `rustdoc[..]--test[..]--cfg[..]foo[..]`" )
210
+ . with_stdout_contains (
211
+ "\
212
+ running 1 test
213
+ test src/lib.rs - (line 2) ... ok
214
+
215
+ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out[..]" ,
216
+ )
217
+ . run ( ) ;
218
+
219
+ // target.triple.rustdocflags in config works
220
+ p. cargo ( "test --doc -v" )
221
+ . arg ( "--config" )
222
+ . arg ( format ! ( "target.{host}.rustdocflags=['--cfg', 'foo']" ) )
223
+ . with_stderr_contains ( "[RUNNING] `rustdoc[..]--test[..]--cfg[..]foo[..]`" )
224
+ . with_stdout_contains (
225
+ "\
226
+ running 1 test
227
+ test src/lib.rs - (line 2) ... ok
228
+
229
+ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out[..]" ,
230
+ )
231
+ . run ( ) ;
232
+ }
You can’t perform that action at this time.
0 commit comments