mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-19 08:40:39 +00:00
Add tests for skip magic trailing comma
<!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary This PR adds tests that verify that the magic trailing comma is not respected if disabled in the formatter options. Our test setup now allows to create a `<fixture-name>.options.json` file that contains an array of configurations that should be tested. <!-- What's the purpose of the change? What does it do, and why? --> ## Test Plan It's all about tests :) <!-- How was it tested? -->
This commit is contained in:
parent
dd0d1afb66
commit
f18a1f70de
27 changed files with 268 additions and 79 deletions
|
@ -220,7 +220,7 @@ impl<'fmt, 'ast, 'buf> JoinCommaSeparatedBuilder<'fmt, 'ast, 'buf> {
|
|||
if let Some(last_end) = self.last_end.take() {
|
||||
if_group_breaks(&text(",")).fmt(self.fmt)?;
|
||||
|
||||
if self.fmt.options().magic_trailing_comma().is_preserve()
|
||||
if self.fmt.options().magic_trailing_comma().is_respect()
|
||||
&& matches!(
|
||||
first_non_trivia_token(last_end, self.fmt.context().contents()),
|
||||
Some(Token {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue