Add extra format selection tests
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 446
- Forks
- 32
- Avg merge
- 16h 48m
- Merged PRs (30d)
- 1
Description
We currently don't have any tests ensuring that other things inside braces don't get formatted when we select a portion of a braced list
Tests 1 and 3 here should format the whole braced expressions, but tests 2 and 4 should only format the selection itself
#[rustfmt::skip]
let (doc, range) = TextDocument::doodle_and_range(
"0+0
1+1
<<{
2+2>>
3+3
}
4+4
",
);
let output = client.format_document_range(&doc, range);
insta::assert_snapshot!(output);
#[rustfmt::skip]
let (doc, range) = TextDocument::doodle_and_range(
"0+0
1+1
{<<
2+2>>
3+3
}
4+4
",
);
let output = client.format_document_range(&doc, range);
insta::assert_snapshot!(output);
#[rustfmt::skip]
let (doc, range) = TextDocument::doodle_and_range(
"0+0
1+1
{
2+2
<<3+3
}>>
4+4
",
);
let output = client.format_document_range(&doc, range);
insta::assert_snapshot!(output);
#[rustfmt::skip]
let (doc, range) = TextDocument::doodle_and_range(
"0+0
1+1
{
2+2
<<3+3
>>}
4+4
",
);
let output = client.format_document_range(&doc, range);
insta::assert_snapshot!(output);
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
Start by locating the existing tests around TextDocument::doodle_and_range and client.format_document_range. Add the four braced-list selection cases shown in the issue and update their insta snapshots so tests 1 and 3 format the whole expression while tests 2 and 4 format only the selection.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100