@@ -986,3 +986,134 @@ For more information try --help
986986 . with_stderr ( stderr)
987987 . run ( ) ;
988988}
989+
990+ #[ test]
991+ fn shows_warnings_on_second_run_without_changes ( ) {
992+ let p = project ( )
993+ . file (
994+ "src/lib.rs" ,
995+ r#"
996+ use std::default::Default;
997+
998+ pub fn foo() {
999+ }
1000+ "# ,
1001+ )
1002+ . build ( ) ;
1003+
1004+ p. cargo ( "fix --allow-no-vcs" )
1005+ . with_stderr_contains ( "[..]warning: unused import[..]" )
1006+ . run ( ) ;
1007+
1008+ p. cargo ( "fix --allow-no-vcs" )
1009+ . with_stderr_contains ( "[..]warning: unused import[..]" )
1010+ . run ( ) ;
1011+ }
1012+
1013+ #[ test]
1014+ fn shows_warnings_on_second_run_without_changes_on_multiple_targets ( ) {
1015+ let p = project ( )
1016+ . file (
1017+ "src/lib.rs" ,
1018+ r#"
1019+ use std::default::Default;
1020+
1021+ pub fn a() -> u32 { 3 }
1022+ "# ,
1023+ )
1024+ . file (
1025+ "src/main.rs" ,
1026+ r#"
1027+ use std::default::Default;
1028+ fn main() { println!("3"); }
1029+ "# ,
1030+ )
1031+ . file (
1032+ "tests/foo.rs" ,
1033+ r#"
1034+ use std::default::Default;
1035+ #[test]
1036+ fn foo_test() {
1037+ println!("3");
1038+ }
1039+ "# ,
1040+ )
1041+ . file (
1042+ "tests/bar.rs" ,
1043+ r#"
1044+ use std::default::Default;
1045+
1046+ #[test]
1047+ fn foo_test() {
1048+ println!("3");
1049+ }
1050+ "# ,
1051+ )
1052+ . file (
1053+ "examples/fooxample.rs" ,
1054+ r#"
1055+ use std::default::Default;
1056+
1057+ fn main() {
1058+ println!("3");
1059+ }
1060+ "# ,
1061+ )
1062+ . build ( ) ;
1063+
1064+ p. cargo ( "fix --allow-no-vcs --all-targets" )
1065+ . with_stderr_contains ( " --> examples/fooxample.rs:2:21" )
1066+ . with_stderr_contains ( " --> src/lib.rs:2:21" )
1067+ . with_stderr_contains ( " --> src/main.rs:2:21" )
1068+ . with_stderr_contains ( " --> tests/bar.rs:2:21" )
1069+ . with_stderr_contains ( " --> tests/foo.rs:2:21" )
1070+ . run ( ) ;
1071+
1072+ p. cargo ( "fix --allow-no-vcs --all-targets" )
1073+ . with_stderr_contains ( " --> examples/fooxample.rs:2:21" )
1074+ . with_stderr_contains ( " --> src/lib.rs:2:21" )
1075+ . with_stderr_contains ( " --> src/main.rs:2:21" )
1076+ . with_stderr_contains ( " --> tests/bar.rs:2:21" )
1077+ . with_stderr_contains ( " --> tests/foo.rs:2:21" )
1078+ . run ( ) ;
1079+ }
1080+
1081+ #[ test]
1082+ fn doesnt_rebuild_dependencies ( ) {
1083+ let p = project ( )
1084+ . file (
1085+ "Cargo.toml" ,
1086+ r#"
1087+ [package]
1088+ name = "foo"
1089+ version = "0.1.0"
1090+
1091+ [dependencies]
1092+ bar = { path = 'bar' }
1093+
1094+ [workspace]
1095+ "# ,
1096+ ) . file ( "src/lib.rs" , "extern crate bar;" )
1097+ . file ( "bar/Cargo.toml" , & basic_manifest ( "bar" , "0.1.0" ) )
1098+ . file ( "bar/src/lib.rs" , "" )
1099+ . build ( ) ;
1100+
1101+ p. cargo ( "fix --allow-no-vcs -p foo" )
1102+ . env ( "__CARGO_FIX_YOLO" , "1" )
1103+ . with_stdout ( "" )
1104+ . with_stderr ( "\
1105+ [CHECKING] bar v0.1.0 ([..])
1106+ [CHECKING] foo v0.1.0 ([..])
1107+ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
1108+ " )
1109+ . run ( ) ;
1110+
1111+ p. cargo ( "fix --allow-no-vcs -p foo" )
1112+ . env ( "__CARGO_FIX_YOLO" , "1" )
1113+ . with_stdout ( "" )
1114+ . with_stderr ( "\
1115+ [CHECKING] foo v0.1.0 ([..])
1116+ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
1117+ " )
1118+ . run ( ) ;
1119+ }
0 commit comments