File tree 1 file changed +63
-0
lines changed
1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -784,3 +784,66 @@ Caused by:
784
784
. with_status ( 101 )
785
785
. run ( ) ;
786
786
}
787
+
788
+ #[ cargo_test]
789
+ fn root_dir_diagnostics ( ) {
790
+ let p = ProjectBuilder :: new ( paths:: root ( ) )
791
+ . no_manifest ( ) // we are placing it in a different dir
792
+ . file (
793
+ "ws_root/Cargo.toml" ,
794
+ r#"
795
+ [package]
796
+ name = "foo"
797
+ version = "0.1.0"
798
+ edition = "2015"
799
+ authors = []
800
+ "# ,
801
+ )
802
+ . file ( "ws_root/src/lib.rs" , "invalid;" )
803
+ . build ( ) ;
804
+
805
+ p. cargo ( "check" )
806
+ . arg ( "--manifest-path=ws_root/Cargo.toml" )
807
+ . with_status ( 101 )
808
+ . with_stderr_data ( str![ [ r#"
809
+ [CHECKING] foo v0.1.0 ([ROOT]/ws_root)
810
+ [ERROR] [..]
811
+ --> src/lib.rs:1:8
812
+ |
813
+ 1 | invalid;
814
+ | [..]
815
+
816
+ [ERROR] could not compile `foo` (lib) due to 1 previous error
817
+
818
+ "# ] ] )
819
+ . run ( ) ;
820
+ }
821
+
822
+ #[ cargo_test]
823
+ fn root_dir_file_macro ( ) {
824
+ let p = ProjectBuilder :: new ( paths:: root ( ) )
825
+ . no_manifest ( ) // we are placing it in a different dir
826
+ . file (
827
+ "ws_root/Cargo.toml" ,
828
+ r#"
829
+ [package]
830
+ name = "foo"
831
+ version = "0.1.0"
832
+ edition = "2015"
833
+ authors = []
834
+ "# ,
835
+ )
836
+ . file (
837
+ "ws_root/src/main.rs" ,
838
+ r#"fn main() { println!("{}", file!()); }"# ,
839
+ )
840
+ . build ( ) ;
841
+
842
+ p. cargo ( "run" )
843
+ . arg ( "--manifest-path=ws_root/Cargo.toml" )
844
+ . with_stdout_data ( str![ [ r#"
845
+ src/main.rs
846
+
847
+ "# ] ] )
848
+ . run ( ) ;
849
+ }
You can’t perform that action at this time.
0 commit comments