diff options
Diffstat (limited to '.emacs.d/lisp/rust-mode-tests.el')
| -rw-r--r-- | .emacs.d/lisp/rust-mode-tests.el | 102 |
1 files changed, 100 insertions, 2 deletions
diff --git a/.emacs.d/lisp/rust-mode-tests.el b/.emacs.d/lisp/rust-mode-tests.el index 62cd261..259afb2 100644 --- a/.emacs.d/lisp/rust-mode-tests.el +++ b/.emacs.d/lisp/rust-mode-tests.el | |||
| @@ -887,6 +887,98 @@ struct A { | |||
| 887 | " | 887 | " |
| 888 | )) | 888 | )) |
| 889 | 889 | ||
| 890 | ;; When point is inside an example code block, indent-for-tab-command | ||
| 891 | ;; should reindent the example code. | ||
| 892 | (ert-deftest indent-inside-doc-example () | ||
| 893 | (rust-test-manip-code | ||
| 894 | " | ||
| 895 | /// ``` | ||
| 896 | /// if 2 + 2 == 4 { | ||
| 897 | /// success(); | ||
| 898 | /// } | ||
| 899 | /// ``` | ||
| 900 | " | ||
| 901 | 34 | ||
| 902 | #'indent-for-tab-command | ||
| 903 | " | ||
| 904 | /// ``` | ||
| 905 | /// if 2 + 2 == 4 { | ||
| 906 | /// success(); | ||
| 907 | /// } | ||
| 908 | /// ``` | ||
| 909 | " | ||
| 910 | 38)) | ||
| 911 | |||
| 912 | ;; Inside example code blocks, hidden lines starting with "# " should | ||
| 913 | ;; be indented as if the "# " wasn't there. | ||
| 914 | (ert-deftest indent-inside-doc-example-hidden-code () | ||
| 915 | (rust-test-manip-code | ||
| 916 | " | ||
| 917 | /// ``` | ||
| 918 | /// # if 2 + 2 == 4 { | ||
| 919 | /// # success(); | ||
| 920 | /// # } | ||
| 921 | /// ``` | ||
| 922 | " | ||
| 923 | 36 | ||
| 924 | #'indent-for-tab-command | ||
| 925 | " | ||
| 926 | /// ``` | ||
| 927 | /// # if 2 + 2 == 4 { | ||
| 928 | /// # success(); | ||
| 929 | /// # } | ||
| 930 | /// ``` | ||
| 931 | " | ||
| 932 | 42)) | ||
| 933 | |||
| 934 | ;; Inside example code blocks, hidden lines starting with "# " | ||
| 935 | ;; shouldn't affect indentation of non-hidden lines. | ||
| 936 | (ert-deftest indent-inside-doc-example-with-hidden-block () | ||
| 937 | (rust-test-manip-code | ||
| 938 | " | ||
| 939 | /// ``` | ||
| 940 | /// # if 2 + 2 == 4 { | ||
| 941 | /// success(); | ||
| 942 | /// # } | ||
| 943 | /// ``` | ||
| 944 | " | ||
| 945 | 40 | ||
| 946 | #'indent-for-tab-command | ||
| 947 | " | ||
| 948 | /// ``` | ||
| 949 | /// # if 2 + 2 == 4 { | ||
| 950 | /// success(); | ||
| 951 | /// # } | ||
| 952 | /// ``` | ||
| 953 | " | ||
| 954 | 36)) | ||
| 955 | |||
| 956 | ;; When point is outside the comment, indent-for-tab-command should | ||
| 957 | ;; reindent the comment line without affecting its contents. | ||
| 958 | (ert-deftest indent-outside-doc-example () | ||
| 959 | (rust-test-manip-code | ||
| 960 | " | ||
| 961 | impl Foo { | ||
| 962 | /// ``` | ||
| 963 | /// if 2 + 2 == 4 { | ||
| 964 | /// success(); | ||
| 965 | /// } | ||
| 966 | /// ``` | ||
| 967 | } | ||
| 968 | " | ||
| 969 | 49 | ||
| 970 | #'indent-for-tab-command | ||
| 971 | " | ||
| 972 | impl Foo { | ||
| 973 | /// ``` | ||
| 974 | /// if 2 + 2 == 4 { | ||
| 975 | /// success(); | ||
| 976 | /// } | ||
| 977 | /// ``` | ||
| 978 | } | ||
| 979 | " | ||
| 980 | 53)) | ||
| 981 | |||
| 890 | (defconst rust-test-motion-string | 982 | (defconst rust-test-motion-string |
| 891 | " | 983 | " |
| 892 | fn fn1(arg: i32) -> bool { | 984 | fn fn1(arg: i32) -> bool { |
| @@ -3601,6 +3693,8 @@ let b = 1;" | |||
| 3601 | (insert "note: `ZZZ` could also refer to the constant imported here -> b\n --> file4.rs:12:34\n\n") | 3693 | (insert "note: `ZZZ` could also refer to the constant imported here -> b\n --> file4.rs:12:34\n\n") |
| 3602 | (insert " ::: file5.rs:12:34\n\n") | 3694 | (insert " ::: file5.rs:12:34\n\n") |
| 3603 | (insert "thread 'main' panicked at src/file7.rs:12:34:\n\n") | 3695 | (insert "thread 'main' panicked at src/file7.rs:12:34:\n\n") |
| 3696 | (insert "[src/file8.rs:159:5] symbol_value(SOME_VAR) = Some(\n\n") | ||
| 3697 | (insert " at file9.rs:12:34\n\n") | ||
| 3604 | ;; should not match | 3698 | ;; should not match |
| 3605 | (insert "werror found a -> b\n --> no_match.rs:12:34\n\n") | 3699 | (insert "werror found a -> b\n --> no_match.rs:12:34\n\n") |
| 3606 | (insert "error[E0061]: this function takes 1 parameter but 2 parameters were supplied\n --> file6.rs:132:34 | 3700 | (insert "error[E0061]: this function takes 1 parameter but 2 parameters were supplied\n --> file6.rs:132:34 |
| @@ -3620,12 +3714,16 @@ let b = 1;" | |||
| 3620 | (("file5.rs" "12" "34" compilation-info "file5.rs:12:34")) | 3714 | (("file5.rs" "12" "34" compilation-info "file5.rs:12:34")) |
| 3621 | ((like-previous-one "82" back-to-indentation compilation-info "82") | 3715 | ((like-previous-one "82" back-to-indentation compilation-info "82") |
| 3622 | (like-previous-one "132" back-to-indentation compilation-info "132")) | 3716 | (like-previous-one "132" back-to-indentation compilation-info "132")) |
| 3623 | (("src/file7.rs" "12" "34" nil "src/file7.rs:12:34"))) | 3717 | (("src/file7.rs" "12" "34" nil "src/file7.rs:12:34")) |
| 3718 | (("src/file8.rs" "159" "5" compilation-info "src/file8.rs:159:5")) | ||
| 3719 | (("file9.rs" "12" "34" compilation-info "file9.rs:12:34"))) | ||
| 3624 | (mapcar #'rust-collect-matches | 3720 | (mapcar #'rust-collect-matches |
| 3625 | (list rustc-compilation-regexps | 3721 | (list rustc-compilation-regexps |
| 3626 | rustc-colon-compilation-regexps | 3722 | rustc-colon-compilation-regexps |
| 3627 | rustc-refs-compilation-regexps | 3723 | rustc-refs-compilation-regexps |
| 3628 | rustc-panics-compilation-regexps)))))) | 3724 | rustc-panics-compilation-regexps |
| 3725 | rustc-dbg!-compilation-regexps | ||
| 3726 | rustc-backtrace-compilation-regexps)))))) | ||
| 3629 | 3727 | ||
| 3630 | ;; If electric-pair-mode is available, load it and run the tests that use it. If not, | 3728 | ;; If electric-pair-mode is available, load it and run the tests that use it. If not, |
| 3631 | ;; no error--the tests will be skipped. | 3729 | ;; no error--the tests will be skipped. |
