aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | Switch to expect for the rest of inlay testsAleksey Kladov2020-06-301-74/+100
| |
* | Simplify most of the inlay hints testsAleksey Kladov2020-06-301-623/+177
| |
* | Refactor runnable testsAleksey Kladov2020-06-301-525/+511
| |
* | Remove confusing APIAleksey Kladov2020-06-302-23/+15
| |
* | Rewrite goto implementation testsAleksey Kladov2020-06-303-104/+119
| |
* | Rewrite goto definition testsAleksey Kladov2020-06-303-613/+483
| |
* | Merge #5132bors[bot]2020-06-301-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | 5132: Fix some typos r=matklad a=davidlattimore Co-authored-by: David Lattimore <[email protected]>
| * | Fix some typosDavid Lattimore2020-06-301-1/+1
| |/
* | Merge #5101bors[bot]2020-06-301-8/+33
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5101: Add expect -- a light-weight alternative to insta r=matklad a=matklad This PR implements a small snapshot-testing library. Snapshot updating is done by setting an env var, or by using editor feature (which runs a test with env-var set). Here's workflow for updating a failing test: ![expect](https://user-images.githubusercontent.com/1711539/85926956-28afa080-b8a3-11ea-9260-c6d0d8914d0b.gif) Here's workflow for adding a new test: ![expect-fresh](https://user-images.githubusercontent.com/1711539/85926961-306f4500-b8a3-11ea-9369-f2373e327a3f.gif) Note that colorized diffs are not implemented in this PR, but should be easy to add (we already use them in test_utils). Main differences from insta (which is essential for rust-analyzer development, thanks @mitsuhiko!): * self-updating tests, no need for a separate tool * fewer features (only inline snapshots, no redactions) * fewer deps (no yaml, no persistence) * tighter integration with editor * first-class snapshot object, which can be used to write test functions (as opposed to testing macros) * trivial to tweak for rust-analyzer needs, by virtue of being a workspace member. I think eventually we should converge to a single snapshot testing library, but I am not sure that `expect` is exactly right, so I suggest rolling with both insta and expect for some time (if folks agree that expect might be better in the first place!). # Editor Integration Implementation The thing I am most excited about is the ability to update a specific snapshot from the editor. I want this to be available to other snapshot-testing libraries (cc @mitsuhiko, @aaronabramov), so I want to document how this works. The ideal UI here would be a code action (:bulb:). Unfortunately, it seems like it is impossible to implement without some kind of persistence (if you save test failures into some kind of a database, like insta does, than you can read the database from the editor plugin). Note that it is possible to highlight error by outputing error message in rustc's format. Unfortunately, one can't use the same trick to implement a quick fix. For this reason, expect makes use of another rust-analyzer feature -- ability to run a single test at the cursor position. This does need some expect-specific code in rust-analyzer unfortunately. Specifically, if rust-analyzer notices that the cursor is on `expect!` macro, it adds a special flag to runnable's JSON. However, given #5017 it is possible to approximate this well-enough without rust-analyzer integration. Specifically, an extension can register a special runner which checks (using regexes) if rust-anlyzer runnable covers text with specific macro invocation and do special magic in that case. closes #3835 Co-authored-by: Aleksey Kladov <[email protected]>
| * Add example expect test for goto definitionAleksey Kladov2020-06-271-8/+33
| |
* | Merge #5105bors[bot]2020-06-282-8/+3
|\ \ | | | | | | | | | | | | | | | | | | | | | 5105: Simlify with matches!() r=matklad a=Veetaha Co-authored-by: Veetaha <[email protected]>
| * | Simlify with matches!()Veetaha2020-06-282-8/+3
| | |
* | | Don't show ra_fixture param hintsAleksey Kladov2020-06-281-1/+2
|/ /
* | Remove unneeded code, filename from tests, fix rebasing issuesPaul Daniel Faria2020-06-278-13/+72
| |
* | Revert ide highlighting changes (addressing on another branch)Paul Daniel Faria2020-06-279-100/+10
| |
* | Add HighlightTag::Operator, use it for unsafe deref. Move unsafe validation ↵Paul Daniel Faria2020-06-276-7/+7
| | | | | | | | to its own file
* | Account for deref token in syntax highlighting of unsafe, add test for that casePaul Daniel Faria2020-06-271-0/+1
| |
* | Fix typo in testPaul Daniel Faria2020-06-271-1/+1
| |
* | Move diagnostics back into expr, add tests for diagnostics, fix logic to ↵Paul Daniel Faria2020-06-271-0/+2
| | | | | | | | account for derefs of raw ptrs
* | Add unsafe diagnostics and unsafe highlightingPaul Daniel Faria2020-06-271-0/+28
|/
* Add `::` to label for `crate::` completionAleksey Kladov2020-06-271-7/+7
|
* cleanupAleksey Kladov2020-06-271-13/+10
|
* Fix matchig brace for pipesAleksey Kladov2020-06-251-1/+5
|
* matching brace works for | in lambdasAleksey Kladov2020-06-251-5/+22
|
* SimplifyAleksey Kladov2020-06-242-67/+18
|
* SimplifyAleksey Kladov2020-06-244-47/+38
|
* SimplifyAleksey Kladov2020-06-241-6/+3
|
* SimplifyAleksey Kladov2020-06-242-14/+3
|
* SimplifyAleksey Kladov2020-06-241-10/+6
|
* Remove duplicationAleksey Kladov2020-06-248-41/+34
|
* More consistent usage of fixturesAleksey Kladov2020-06-2416-1061/+1070
|
* Use fixtures moreAleksey Kladov2020-06-246-133/+135
|
* Merge #4940bors[bot]2020-06-2410-37/+86
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 4940: Add support for marking doctest items as distinct from normal code r=ltentrup a=Nashenas88 This adds `HighlightTag::Generic | HighlightModifier::Injected` as the default highlight for all elements within a doctest. Please feel free to suggest that a new tag be created or a different one used. ![Screenshot from 2020-06-23 09-18-13](https://user-images.githubusercontent.com/1673130/85408493-9752ce00-b532-11ea-94fe-197353ccc778.png) Fixes #4929 Fixes #4939 Co-authored-by: Paul Daniel Faria <[email protected]> Co-authored-by: Paul Daniel Faria <[email protected]>
| * Improve readability be replacing hard-to-read if-else branches with a matchPaul Daniel Faria2020-06-241-16/+20
| |
| * Remove unrelated changePaul Daniel Faria2020-06-231-4/+2
| |
| * Update comment for pop_and_injectPaul Daniel Faria2020-06-231-2/+2
| | | | | | Co-authored-by: Leander Tentrup <[email protected]>
| * Update injection mechanism and stop injecting through highlight element, ↵Paul Daniel Faria2020-06-2312-216/+237
| | | | | | | | switch to more general new highlight tag, generic
| * Add punctuation highlighting for highlighting punctuation in doctests, fix ↵Paul Daniel Faria2020-06-2312-223/+224
| | | | | | | | highlighting in doctests
| * Add default color and opacity for documentation and injected, respectively, ↵Paul Daniel Faria2020-06-237-0/+14
| | | | | | | | in the html generator
| * Add support for marking doctest items as distinct from normal code, add ↵Paul Daniel Faria2020-06-237-34/+45
| | | | | | | | default tag to all doctest elements
* | More principled indentation trimming in fixturesAleksey Kladov2020-06-239-325/+310
| |
* | Slightly better nameAleksey Kladov2020-06-231-2/+2
| |
* | Cut problematic dependencyAleksey Kladov2020-06-231-1/+6
| |
* | Nicer APIAleksey Kladov2020-06-231-8/+8
| |
* | SimplifyAleksey Kladov2020-06-231-8/+6
| |
* | SimplifyAleksey Kladov2020-06-231-8/+8
|/
* New VFSAleksey Kladov2020-06-235-22/+20
|
* Merge #5002bors[bot]2020-06-233-5/+15
|\ | | | | | | | | | | | | | | 5002: Fix underflow panic when doctests are at top of file r=Nashenas88 a=Nashenas88 While debugging a comment at the top of a test string, I discovered that the offset calculations could underflow and panic. This only seemed to occur in tests, I assume because it's running a debug mode. The wrapping is quickly fixed later on in release mode, which is why this seems to have gone unnoticed. The new checks ensure the value is always positive or zero. Co-authored-by: Paul Daniel Faria <[email protected]>
| * Fix underflow panic when doctests are at top of filePaul Daniel Faria2020-06-233-5/+15
| |
* | Merge #4999bors[bot]2020-06-231-0/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | 4999: SSR: Allow matching of whole macro calls r=matklad a=davidlattimore Matching within macro calls is to come later and matching of macro calls within macro calls later still. Co-authored-by: David Lattimore <[email protected]>