File tree Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Original file line number Diff line number Diff line change @@ -221,3 +221,73 @@ Caused by:
221221 . with_status ( 101 )
222222 . run ( ) ;
223223}
224+
225+ #[ cargo_test]
226+ fn hard_warning_deny ( ) {
227+ let p = project ( )
228+ . file (
229+ "Cargo.toml" ,
230+ & format ! (
231+ r#"
232+ [package]
233+ name = "foo"
234+ version = "0.0.1"
235+ edition = "2021"
236+ "#
237+ ) ,
238+ )
239+ . file ( "src/main.rs" , "fn main() {}" )
240+ . build ( ) ;
241+ p. cargo ( "rustc" )
242+ . masquerade_as_nightly_cargo ( & [ "warnings" ] )
243+ . arg ( "-Zwarnings" )
244+ . arg ( "--config" )
245+ . arg ( "build.warnings='deny'" )
246+ . arg ( "--" )
247+ . arg ( "-ox.rs" )
248+ . with_stderr_data ( str![ [ r#"
249+ [COMPILING] foo v0.0.1 ([ROOT]/foo)
250+ [WARNING] [..]
251+
252+ [WARNING] [..]
253+
254+ [WARNING] `foo` (bin "foo") generated 2 warnings
255+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
256+ [ERROR] warnings are denied by `build.warnings` configuration
257+
258+ "# ] ] )
259+ . with_status ( 101 )
260+ . run ( ) ;
261+ }
262+
263+ #[ cargo_test]
264+ fn hard_warning_allow ( ) {
265+ let p = project ( )
266+ . file (
267+ "Cargo.toml" ,
268+ & format ! (
269+ r#"
270+ [package]
271+ name = "foo"
272+ version = "0.0.1"
273+ edition = "2021"
274+ "#
275+ ) ,
276+ )
277+ . file ( "src/main.rs" , "fn main() {}" )
278+ . build ( ) ;
279+ p. cargo ( "rustc" )
280+ . masquerade_as_nightly_cargo ( & [ "warnings" ] )
281+ . arg ( "-Zwarnings" )
282+ . arg ( "--config" )
283+ . arg ( "build.warnings='allow'" )
284+ . arg ( "--" )
285+ . arg ( "-ox.rs" )
286+ . with_stderr_data ( str![ [ r#"
287+ [COMPILING] foo v0.0.1 ([ROOT]/foo)
288+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
289+
290+ "# ] ] )
291+ . with_status ( 0 )
292+ . run ( ) ;
293+ }
You can’t perform that action at this time.
0 commit comments