summaryrefslogtreecommitdiff
path: root/rust-mode-tests.el
AgeCommit message (Collapse)Author
2025-06-20Add regexp for stack backtrace locationscydparser
2025-06-09Add compilation regexp to match ‘dbg!’ outputAleksei Gusev
While debugging tests it’s annoying when ‘compilation-mode’ matches ‘dbg!’ output incorrectly. Currently, rust-mode’s regexps assign it as an error and incorrectly include ‘[’. The proposed change adds a regexp to match such things and assign them info level.
2024-11-11Add tests for indenting example code blocks.Benjamin Moody
2024-02-13Match panics in compilation-modeLucas Soriano del Pino
If we encounter a panic when executing Rust code in `compilation-mode`, we now correctly highlight the location where the panic occurred. For example: ``` thread 'main' panicked at src/main.rs:2:5: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` Here, `src/main.rs:2:5` is highlighted. The developer is then able to execute `compile-goto-error` to jump to the correct spot in the code. Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com> Co-authored-by: zlef <zachlefevre@gmail.com>
2023-08-04dbg! insertion:Michael Lee
- Change rust-insert-dbg to ...-sexp - Handle the cases where forwarding is impossible - Add tests
2023-08-03Improve the usability of `rust-dbg-wrap-or-unwrap` (#498)Michael Lee
* rust-dbg-wrap-or-unwrap: Cut unnecessary conditional branches for region-active-p * rust-dbg-wrap-or-unwrap: Do not using save-excursion anymore * rust-dbg-wrap-or-unwrap: Use cond, allow more other cases. * rust-dbg-wrap-or-unwrap: Introduce rust-insert-dbg-alone * rust-dbg-wrap-or-unwrap: Adjust cursor position after insertion * rust-dbg-wrap-or-unwrap: Add tests for empty line * rust-dbg-wrap-or-unwrap: Test final position in empty line case * rust-dbg-wrap-or-unwrap: Test final cursor position in existing wrap tests
2023-04-26Don’t duplicate test name.Philipp Stephani
Emacs 29 will signal an error in this case in batch mode, and in any case the first test in the duplicate series will never run.
2023-01-15Merge pull request #488 from jimblandy/fill-variablesJim Blandy
Establish more-controlled environment for fill-paragraph tests.
2023-01-11Test pub scoped defun recognitionChris Gregory
2023-01-11Establish more-controlled environment for fill-paragraph tests.Jim Blandy
Define a macro `rust-test-with-standard-fill-settings` to bind all the variables that affect `fill-paragraph`, and use it around all calls to `fill-paragraph`. Some tests based on `rust-test-fill-paragraph` were failing for me because I set `sentence-end-double-space` to nil, so double spaces after periods in the test input were getting collapsed into single spaces.
2022-11-02Simplify and correct angle bracket propertizing and macro argument detection.Jim Blandy
Fixes #465. When `rust-syntax-propertize` uses `rust-macro-scopes` to find ranges of text that are macro arguments, it ends up inadvertently poisoning the `syntax-ppss` cache by applying it to text that doesn't have the necessary `syntax-table` properties applied yet - the very job that `rust-syntax-propertize` is trying to do. However, `rust-macro-scopes` does much more work than necessary. Rather than producing a list of ranges of macro arguments, we can just use the list of enclosing opening parens provided by syntax-ppss, checking each paren to see if it seems to be a macro or `macro_rules` call. We have to keep syntax-ppss's cache accurate for other reasons anyway, so we might as well just use its data, rather than introducing another cache of our own - especially a problematic one (see #465). * rust-mode.el (rust-in-macro): Consult `syntax-ppss`'s list of enclosing parens, rather than using `rust-macro-scope`. Remove optional arguments, which were only used by tests. (rust-macro-scopes, rust-macro-scope): Delete. Now we just use `syntax-ppss`'s internal cache. (rust-syntax-propertize): Don't bind `rust-macro-scopes`. (rust-looking-back-macro-rules): New function. (rust-looking-back-macro): Support a space between macro name and `!`, by consulting `rust-expression-introducers`. (rust-expression-introducers): New constant. Use in `rust-looking-back-macro` and `rust-is-in-expression-context`. (rust-is-in-expression-context): Use `rust-expression-introducers`. (rust-looking-back-ident): Don't use `looking-back`. We've already moved to the correct spot for `looking-at`, within a `save-excursion`. * rust-mode-tests.el: Update tests.
2022-09-16Skip test if Cargo isn’t installed.Philipp Stephani
This test requires Cargo and fails if it’s not installed.
2022-08-18more test fixingbrotzeit
2022-08-18fix quirks in rust-mode-tests.elbrotzeit
2022-01-30Highlight the (optional) type suffix of numbers with the type faceChristophe Troestler
2021-12-27Add tests to check the syntax highlighting of &Christophe Troestler
2021-12-25Add a face for the ampersand reference markChristophe Troestler
Customizing this face may improve code readability for some users. By default nothing is set for backward compatibility.
2021-04-23test: Suppress some noisy messagesJonas Bernoulli
2021-04-23Remove "-face" suffix from names of facesJonas Bernoulli
As mentioned in (info "(emacs)Defining Faces") the name of a face > should not end in "-face" (that would be redundant). For historic reasons a few built-in faces actually do end with "-face" and it so happens that our faces are closely related to just those `font-lock' faces and that probably inspired our use of the suffix. Even so, we should stop now.
2020-06-18compile-mode integration: add link to code references. (#391)Nathan Moreau
This allows to jump to code references such as lines 82 and 132 in the following snippet error message. error[E0061]: this function takes 1 parameter but 2 parameters were supplied --> file6.rs:132:34 | 82 | fn duration_ms_since(time: &Option<SystemTime>) -> u128 { | ------------------------------------------------------- defined here ... 132 | self.total_time_ms = duration_ms_since(&self.program_start, 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2020-06-03rustc-colon-compilation-regexps: improve highlighting.Nathan Moreau
2020-05-28Add missing ‘require’ form.Philipp Stephani
‘compilation-face’ is defined in the ‘compile’ library, so we should ‘require’ that library.
2020-05-17Fix various byte compilation warnings in rust-mode-tests.el.Philipp Stephani
- Migrate to lexical binding. - Declare functions that are conditionally-defined. - Migrate off the deprecated ‘cl’ library. - Don’t use ‘setq’ to introduce global variables and constants. - Avoid “unused lexical variable” warnings. - Remove some unused variables. - Stop using interactive-only commands.
2020-05-13Re-implement rust-in-macro for performancePhillip Lord
rust-in-macro could cause significant performance problems resulting in a very choppy user experience. Reimplement rust-in macro in a somewhat simpler manner and in way which allows both allows restriction to parts of the buffer and caching of buffer analysis. Optimize rust-syntax-propertize to use this caching mechanism. Fixes #208 Fixes #288
2020-04-27Fix typosJonas Bernoulli
2020-04-12rustc-compilation-regexps: handle `note` case as compilation-info.Nathan Moreau
2019-12-08imenu: fn items: match async/const and all pub variants. (#346)Nathan Moreau
2019-11-18rust-insert-dbg: handle the case of string literals. (#342)Nathan Moreau
2019-11-08rust-dbg-wrap-or-unwrap: bind to C-c C-d rather than C-c d.Nathan Moreau
see `Key Binding Conventions' in the Emacs manual.
2019-10-31Add a function wrap and unwrap with the dbg! macro.Roey Darwish Dror
2019-10-31electric-pair-mode: prevent self-insert of `>' when already inserted. (#337)Nathan Moreau
2019-10-27Adding GitHub actions.Nathan Moreau
2019-10-23subword-match for built-in formatting macros: add a test.Nathan Moreau
2019-10-18Fix rustc-compilation-regexps: match error messages with dashes. (#331)Nathan Moreau
2019-10-10Highlight variable name in a for-loop (#326)Konstantin Kharlamov
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-10-01rust-mode.el: check for possible space between variable name and type (#325)Konstantin Kharlamov
Fixes the following problem: consider code fn foo(a: u32, b : u32) {} Here, `b` was not highlighted as a variable, because the regex didn't take into account possible space before the colon. Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-28Don't set indent-tabs-mode. (#324)Nathan Moreau
2019-04-16Add test for word boundaries for string ending with r.Evgeny Kurnevsky
2019-03-01Reverted back to font-lock-fontify-bufferMiodrag Milenkovic
because emacs 24 doesn't know about font-lock-ensure
2019-03-01Added angle bracket tests, some of which fail without the fixMiodrag Milenkovic
2019-03-01Replaced font-lock-fontify-buffer with font-lock-ensureMiodrag Milenkovic
2019-01-15Add rust-indent-return-type-to-arguments variableDavid Kellum
This preserves as default (t), the current indentation behavior of `-> ReturnType` when found on its own line: indenting as per the arguments of the above function. When disabled (nil) by the user, however, this will now just indent such a line one level from base-line (e.g. no special treatment). Includes a basic test.
2018-12-18imenu: handle lifetimes in impl blocks.Nathan Moreau
2018-06-07Fix font-locking of "let ref"Tom Tromey
Fixes #271
2018-02-15Fixed indent when ? operator is used in chained method callsJonas Westlund
2018-02-15Merge pull request #253 from jjwest/masterNiko Matsakis
Improved font-locking for print macros
2018-01-09Do not indent where clause by default (follow standard) #257Sebastien Chapuis
2017-12-08Improved font-locking for print macrosJonas Westlund
2017-09-14Remove `float`, `int`, and `uint` as built-in types.Jake Goulding
These went away pre Rust-1.0 and are valid identifiers. Went ahead and removed them from the tests as well, replacing them with real types of the same number of characters.
2017-08-21Renamed and relocated if-let font-lock testJonas Westlund