aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cargo_watch/src/conv/test.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_cargo_watch/src/conv/test.rs')
-rw-r--r--crates/ra_cargo_watch/src/conv/test.rs229
1 files changed, 229 insertions, 0 deletions
diff --git a/crates/ra_cargo_watch/src/conv/test.rs b/crates/ra_cargo_watch/src/conv/test.rs
index 6817245c2..381992388 100644
--- a/crates/ra_cargo_watch/src/conv/test.rs
+++ b/crates/ra_cargo_watch/src/conv/test.rs
@@ -698,3 +698,232 @@ fn snap_handles_macro_location() {
698 let diag = map_rust_diagnostic_to_lsp(&diag, &workspace_root).expect("couldn't map diagnostic"); 698 let diag = map_rust_diagnostic_to_lsp(&diag, &workspace_root).expect("couldn't map diagnostic");
699 insta::assert_debug_snapshot!(diag); 699 insta::assert_debug_snapshot!(diag);
700} 700}
701
702#[test]
703fn snap_macro_compiler_error() {
704 let diag = parse_diagnostic(
705 r##"{
706 "rendered": "error: Please register your known path in the path module\n --> crates/ra_hir_def/src/path.rs:265:9\n |\n265 | compile_error!(\"Please register your known path in the path module\")\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n | \n ::: crates/ra_hir_def/src/data.rs:80:16\n |\n80 | let path = path![std::future::Future];\n | -------------------------- in this macro invocation\n\n",
707 "children": [],
708 "code": null,
709 "level": "error",
710 "message": "Please register your known path in the path module",
711 "spans": [
712 {
713 "byte_end": 8285,
714 "byte_start": 8217,
715 "column_end": 77,
716 "column_start": 9,
717 "expansion": {
718 "def_site_span": {
719 "byte_end": 8294,
720 "byte_start": 7858,
721 "column_end": 2,
722 "column_start": 1,
723 "expansion": null,
724 "file_name": "crates/ra_hir_def/src/path.rs",
725 "is_primary": false,
726 "label": null,
727 "line_end": 267,
728 "line_start": 254,
729 "suggested_replacement": null,
730 "suggestion_applicability": null,
731 "text": [
732 {
733 "highlight_end": 28,
734 "highlight_start": 1,
735 "text": "macro_rules! __known_path {"
736 },
737 {
738 "highlight_end": 37,
739 "highlight_start": 1,
740 "text": " (std::iter::IntoIterator) => {};"
741 },
742 {
743 "highlight_end": 33,
744 "highlight_start": 1,
745 "text": " (std::result::Result) => {};"
746 },
747 {
748 "highlight_end": 29,
749 "highlight_start": 1,
750 "text": " (std::ops::Range) => {};"
751 },
752 {
753 "highlight_end": 33,
754 "highlight_start": 1,
755 "text": " (std::ops::RangeFrom) => {};"
756 },
757 {
758 "highlight_end": 33,
759 "highlight_start": 1,
760 "text": " (std::ops::RangeFull) => {};"
761 },
762 {
763 "highlight_end": 31,
764 "highlight_start": 1,
765 "text": " (std::ops::RangeTo) => {};"
766 },
767 {
768 "highlight_end": 40,
769 "highlight_start": 1,
770 "text": " (std::ops::RangeToInclusive) => {};"
771 },
772 {
773 "highlight_end": 38,
774 "highlight_start": 1,
775 "text": " (std::ops::RangeInclusive) => {};"
776 },
777 {
778 "highlight_end": 27,
779 "highlight_start": 1,
780 "text": " (std::ops::Try) => {};"
781 },
782 {
783 "highlight_end": 22,
784 "highlight_start": 1,
785 "text": " ($path:path) => {"
786 },
787 {
788 "highlight_end": 77,
789 "highlight_start": 1,
790 "text": " compile_error!(\"Please register your known path in the path module\")"
791 },
792 {
793 "highlight_end": 7,
794 "highlight_start": 1,
795 "text": " };"
796 },
797 {
798 "highlight_end": 2,
799 "highlight_start": 1,
800 "text": "}"
801 }
802 ]
803 },
804 "macro_decl_name": "$crate::__known_path!",
805 "span": {
806 "byte_end": 8427,
807 "byte_start": 8385,
808 "column_end": 51,
809 "column_start": 9,
810 "expansion": {
811 "def_site_span": {
812 "byte_end": 8611,
813 "byte_start": 8312,
814 "column_end": 2,
815 "column_start": 1,
816 "expansion": null,
817 "file_name": "crates/ra_hir_def/src/path.rs",
818 "is_primary": false,
819 "label": null,
820 "line_end": 277,
821 "line_start": 270,
822 "suggested_replacement": null,
823 "suggestion_applicability": null,
824 "text": [
825 {
826 "highlight_end": 22,
827 "highlight_start": 1,
828 "text": "macro_rules! __path {"
829 },
830 {
831 "highlight_end": 43,
832 "highlight_start": 1,
833 "text": " ($start:ident $(:: $seg:ident)*) => ({"
834 },
835 {
836 "highlight_end": 51,
837 "highlight_start": 1,
838 "text": " $crate::__known_path!($start $(:: $seg)*);"
839 },
840 {
841 "highlight_end": 87,
842 "highlight_start": 1,
843 "text": " $crate::path::ModPath::from_simple_segments($crate::path::PathKind::Abs, vec!["
844 },
845 {
846 "highlight_end": 76,
847 "highlight_start": 1,
848 "text": " $crate::path::__name![$start], $($crate::path::__name![$seg],)*"
849 },
850 {
851 "highlight_end": 11,
852 "highlight_start": 1,
853 "text": " ])"
854 },
855 {
856 "highlight_end": 8,
857 "highlight_start": 1,
858 "text": " });"
859 },
860 {
861 "highlight_end": 2,
862 "highlight_start": 1,
863 "text": "}"
864 }
865 ]
866 },
867 "macro_decl_name": "path!",
868 "span": {
869 "byte_end": 2966,
870 "byte_start": 2940,
871 "column_end": 42,
872 "column_start": 16,
873 "expansion": null,
874 "file_name": "crates/ra_hir_def/src/data.rs",
875 "is_primary": false,
876 "label": null,
877 "line_end": 80,
878 "line_start": 80,
879 "suggested_replacement": null,
880 "suggestion_applicability": null,
881 "text": [
882 {
883 "highlight_end": 42,
884 "highlight_start": 16,
885 "text": " let path = path![std::future::Future];"
886 }
887 ]
888 }
889 },
890 "file_name": "crates/ra_hir_def/src/path.rs",
891 "is_primary": false,
892 "label": null,
893 "line_end": 272,
894 "line_start": 272,
895 "suggested_replacement": null,
896 "suggestion_applicability": null,
897 "text": [
898 {
899 "highlight_end": 51,
900 "highlight_start": 9,
901 "text": " $crate::__known_path!($start $(:: $seg)*);"
902 }
903 ]
904 }
905 },
906 "file_name": "crates/ra_hir_def/src/path.rs",
907 "is_primary": true,
908 "label": null,
909 "line_end": 265,
910 "line_start": 265,
911 "suggested_replacement": null,
912 "suggestion_applicability": null,
913 "text": [
914 {
915 "highlight_end": 77,
916 "highlight_start": 9,
917 "text": " compile_error!(\"Please register your known path in the path module\")"
918 }
919 ]
920 }
921 ]
922}
923 "##,
924 );
925
926 let workspace_root = PathBuf::from("/test/");
927 let diag = map_rust_diagnostic_to_lsp(&diag, &workspace_root).expect("couldn't map diagnostic");
928 insta::assert_debug_snapshot!(diag);
929}