rust-lang / rust-lang/rust-analyzer
Place test lens for rstest cases above each case instead of above the function
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
E.g.:
#[rstest]
#[case::top_left(Point::new(2.0, -2.0), Point::new(3.0, -3.0))]
#[case::top_right(Point::new(2.0, 2.0), Point::new(3.0, 3.0))]
#[case::bottom_left(Point::new(-2.0, -2.0), Point::new(-3.0, -3.0))]
#[case::bottom_right(Point::new(-2.0, 2.0), Point::new(-3.0, 3.0))]
#[case::left(Point::new(-2.0, 0.2), Point::new(-3.0, 0.8))]
#[case::right(Point::new(2.0, 0.2), Point::new(3.0, 0.8))]
#[case::top(Point::new(0.2, 2.0), Point::new(0.8, 3.0))]
#[case::bottom(Point::new(0.2, -2.0), Point::new(0.8, -3.0))]
#[case::inside(Point::new(0.2, 0.2), Point::new(0.8, 0.8))]
fn non_intersecting(#[case] p1: Point, #[case] p2: Point) {
let line = LineSegment::new(p1, p2);
assert_eq!(clip_line(line, Window::new(0.0, 0.0, 1.0, 1.0)), None);
}
Currently displays as:
This doesn't allow for easily running / debugging an individual test case past the 5th one in this code because the buttons are scrolled off the right side of the screen.
I think that ideally the buttons to run each test should be on each case and not the test function.
Alternatively (though I think this is worse): wrap the lens to make the other lines visible. This might be a good option to have regardless for people that don't wish to have the lens take up significant vertical space (one extra line per case).
Note: I discovered that there's a right click menu on the play button that allows for running the individual cases after writing up this issue, so there's a decent workaround for this problem.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Reproduce the rstest example in rust-analyzer and locate the test-lens implementation responsible for rendering parameterized cases. The work is done when each rstest case has an accessible run button without requiring horizontal scrolling, while the existing workaround remains functional.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience, testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100