From 5c2c9a50da3a3f534842ffe95a49fe990000a072 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Tue, 6 Jan 2026 21:25:57 +0100 Subject: Update markdown, rust and yasnippet --- .emacs.d/lisp/rust-mode-tests.el | 102 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 2 deletions(-) (limited to '.emacs.d/lisp/rust-mode-tests.el') 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 { " )) +;; When point is inside an example code block, indent-for-tab-command +;; should reindent the example code. +(ert-deftest indent-inside-doc-example () + (rust-test-manip-code + " +/// ``` +/// if 2 + 2 == 4 { +/// success(); +/// } +/// ``` +" + 34 + #'indent-for-tab-command + " +/// ``` +/// if 2 + 2 == 4 { +/// success(); +/// } +/// ``` +" + 38)) + +;; Inside example code blocks, hidden lines starting with "# " should +;; be indented as if the "# " wasn't there. +(ert-deftest indent-inside-doc-example-hidden-code () + (rust-test-manip-code + " +/// ``` +/// # if 2 + 2 == 4 { +/// # success(); +/// # } +/// ``` +" + 36 + #'indent-for-tab-command + " +/// ``` +/// # if 2 + 2 == 4 { +/// # success(); +/// # } +/// ``` +" + 42)) + +;; Inside example code blocks, hidden lines starting with "# " +;; shouldn't affect indentation of non-hidden lines. +(ert-deftest indent-inside-doc-example-with-hidden-block () + (rust-test-manip-code + " +/// ``` +/// # if 2 + 2 == 4 { +/// success(); +/// # } +/// ``` +" + 40 + #'indent-for-tab-command + " +/// ``` +/// # if 2 + 2 == 4 { +/// success(); +/// # } +/// ``` +" + 36)) + +;; When point is outside the comment, indent-for-tab-command should +;; reindent the comment line without affecting its contents. +(ert-deftest indent-outside-doc-example () + (rust-test-manip-code + " +impl Foo { + /// ``` + /// if 2 + 2 == 4 { + /// success(); + /// } + /// ``` +} +" + 49 + #'indent-for-tab-command + " +impl Foo { + /// ``` + /// if 2 + 2 == 4 { + /// success(); + /// } + /// ``` +} +" + 53)) + (defconst rust-test-motion-string " fn fn1(arg: i32) -> bool { @@ -3601,6 +3693,8 @@ let b = 1;" (insert "note: `ZZZ` could also refer to the constant imported here -> b\n --> file4.rs:12:34\n\n") (insert " ::: file5.rs:12:34\n\n") (insert "thread 'main' panicked at src/file7.rs:12:34:\n\n") + (insert "[src/file8.rs:159:5] symbol_value(SOME_VAR) = Some(\n\n") + (insert " at file9.rs:12:34\n\n") ;; should not match (insert "werror found a -> b\n --> no_match.rs:12:34\n\n") (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;" (("file5.rs" "12" "34" compilation-info "file5.rs:12:34")) ((like-previous-one "82" back-to-indentation compilation-info "82") (like-previous-one "132" back-to-indentation compilation-info "132")) - (("src/file7.rs" "12" "34" nil "src/file7.rs:12:34"))) + (("src/file7.rs" "12" "34" nil "src/file7.rs:12:34")) + (("src/file8.rs" "159" "5" compilation-info "src/file8.rs:159:5")) + (("file9.rs" "12" "34" compilation-info "file9.rs:12:34"))) (mapcar #'rust-collect-matches (list rustc-compilation-regexps rustc-colon-compilation-regexps rustc-refs-compilation-regexps - rustc-panics-compilation-regexps)))))) + rustc-panics-compilation-regexps + rustc-dbg!-compilation-regexps + rustc-backtrace-compilation-regexps)))))) ;; If electric-pair-mode is available, load it and run the tests that use it. If not, ;; no error--the tests will be skipped. -- cgit v1.3