Skip to content

Commit d51ae51

Browse files
committed
ruff_python_formatter: add 'line-ending' to test output
It looks like no previous snapshot tests have configured the line ending to anything other than the default, so this wasn't included in the test output. But we would actually like to try and test that line endings are correctly preserved when reformatting code snippets, so we make the option visible in the snapshot.
1 parent 154d733 commit d51ae51

11 files changed

+33
-0
lines changed

crates/ruff_python_formatter/tests/fixtures.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,15 @@ impl fmt::Display for DisplayPyOptions<'_> {
342342
line-width = {line_width}
343343
indent-width = {indent_width}
344344
quote-style = {quote_style:?}
345+
line-ending = {line_ending:?}
345346
magic-trailing-comma = {magic_trailing_comma:?}
346347
docstring-code = {docstring_code:?}
347348
preview = {preview:?}"#,
348349
indent_style = self.0.indent_style(),
349350
indent_width = self.0.indent_width().value(),
350351
line_width = self.0.line_width().value(),
351352
quote_style = self.0.quote_style(),
353+
line_ending = self.0.line_ending(),
352354
magic_trailing_comma = self.0.magic_trailing_comma(),
353355
docstring_code = self.0.docstring_code(),
354356
preview = self.0.preview()

crates/ruff_python_formatter/tests/snapshots/[email protected]

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ indent-style = space
165165
line-width = 88
166166
indent-width = 4
167167
quote-style = Double
168+
line-ending = LineFeed
168169
magic-trailing-comma = Respect
169170
docstring-code = Disabled
170171
preview = Disabled
@@ -332,6 +333,7 @@ indent-style = space
332333
line-width = 88
333334
indent-width = 2
334335
quote-style = Double
336+
line-ending = LineFeed
335337
magic-trailing-comma = Respect
336338
docstring-code = Disabled
337339
preview = Disabled
@@ -499,6 +501,7 @@ indent-style = tab
499501
line-width = 88
500502
indent-width = 8
501503
quote-style = Double
504+
line-ending = LineFeed
502505
magic-trailing-comma = Respect
503506
docstring-code = Disabled
504507
preview = Disabled
@@ -666,6 +669,7 @@ indent-style = tab
666669
line-width = 88
667670
indent-width = 4
668671
quote-style = Double
672+
line-ending = LineFeed
669673
magic-trailing-comma = Respect
670674
docstring-code = Disabled
671675
preview = Disabled

crates/ruff_python_formatter/tests/snapshots/format@docstring_code_examples.py.snap

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ indent-style = space
329329
line-width = 88
330330
indent-width = 4
331331
quote-style = Double
332+
line-ending = LineFeed
332333
magic-trailing-comma = Respect
333334
docstring-code = Disabled
334335
preview = Disabled
@@ -663,6 +664,7 @@ indent-style = space
663664
line-width = 88
664665
indent-width = 2
665666
quote-style = Double
667+
line-ending = LineFeed
666668
magic-trailing-comma = Respect
667669
docstring-code = Disabled
668670
preview = Disabled
@@ -997,6 +999,7 @@ indent-style = tab
997999
line-width = 88
9981000
indent-width = 8
9991001
quote-style = Double
1002+
line-ending = LineFeed
10001003
magic-trailing-comma = Respect
10011004
docstring-code = Disabled
10021005
preview = Disabled
@@ -1331,6 +1334,7 @@ indent-style = tab
13311334
line-width = 88
13321335
indent-width = 4
13331336
quote-style = Double
1337+
line-ending = LineFeed
13341338
magic-trailing-comma = Respect
13351339
docstring-code = Disabled
13361340
preview = Disabled
@@ -1665,6 +1669,7 @@ indent-style = space
16651669
line-width = 88
16661670
indent-width = 4
16671671
quote-style = Double
1672+
line-ending = LineFeed
16681673
magic-trailing-comma = Respect
16691674
docstring-code = Enabled
16701675
preview = Disabled
@@ -1999,6 +2004,7 @@ indent-style = space
19992004
line-width = 88
20002005
indent-width = 2
20012006
quote-style = Double
2007+
line-ending = LineFeed
20022008
magic-trailing-comma = Respect
20032009
docstring-code = Enabled
20042010
preview = Disabled
@@ -2333,6 +2339,7 @@ indent-style = tab
23332339
line-width = 88
23342340
indent-width = 8
23352341
quote-style = Double
2342+
line-ending = LineFeed
23362343
magic-trailing-comma = Respect
23372344
docstring-code = Enabled
23382345
preview = Disabled
@@ -2667,6 +2674,7 @@ indent-style = tab
26672674
line-width = 88
26682675
indent-width = 4
26692676
quote-style = Double
2677+
line-ending = LineFeed
26702678
magic-trailing-comma = Respect
26712679
docstring-code = Enabled
26722680
preview = Disabled

crates/ruff_python_formatter/tests/snapshots/format@expression__bytes.py.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ indent-style = space
133133
line-width = 88
134134
indent-width = 4
135135
quote-style = Double
136+
line-ending = LineFeed
136137
magic-trailing-comma = Respect
137138
docstring-code = Disabled
138139
preview = Disabled
@@ -283,6 +284,7 @@ indent-style = space
283284
line-width = 88
284285
indent-width = 4
285286
quote-style = Single
287+
line-ending = LineFeed
286288
magic-trailing-comma = Respect
287289
docstring-code = Disabled
288290
preview = Disabled

crates/ruff_python_formatter/tests/snapshots/format@expression__string.py.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ indent-style = space
148148
line-width = 88
149149
indent-width = 4
150150
quote-style = Double
151+
line-ending = LineFeed
151152
magic-trailing-comma = Respect
152153
docstring-code = Disabled
153154
preview = Disabled
@@ -322,6 +323,7 @@ indent-style = space
322323
line-width = 88
323324
indent-width = 4
324325
quote-style = Single
326+
line-ending = LineFeed
325327
magic-trailing-comma = Respect
326328
docstring-code = Disabled
327329
preview = Disabled

crates/ruff_python_formatter/tests/snapshots/format@fmt_on_off__fmt_off_docstring.py.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ indent-style = space
3232
line-width = 88
3333
indent-width = 4
3434
quote-style = Double
35+
line-ending = LineFeed
3536
magic-trailing-comma = Respect
3637
docstring-code = Disabled
3738
preview = Disabled
@@ -66,6 +67,7 @@ indent-style = space
6667
line-width = 88
6768
indent-width = 2
6869
quote-style = Double
70+
line-ending = LineFeed
6971
magic-trailing-comma = Respect
7072
docstring-code = Disabled
7173
preview = Disabled

crates/ruff_python_formatter/tests/snapshots/format@fmt_on_off__indent.py.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ indent-style = space
1313
line-width = 88
1414
indent-width = 4
1515
quote-style = Double
16+
line-ending = LineFeed
1617
magic-trailing-comma = Respect
1718
docstring-code = Disabled
1819
preview = Disabled
@@ -28,6 +29,7 @@ indent-style = space
2829
line-width = 88
2930
indent-width = 1
3031
quote-style = Double
32+
line-ending = LineFeed
3133
magic-trailing-comma = Respect
3234
docstring-code = Disabled
3335
preview = Disabled
@@ -43,6 +45,7 @@ indent-style = tab
4345
line-width = 88
4446
indent-width = 4
4547
quote-style = Double
48+
line-ending = LineFeed
4649
magic-trailing-comma = Respect
4750
docstring-code = Disabled
4851
preview = Disabled

crates/ruff_python_formatter/tests/snapshots/format@fmt_on_off__mixed_space_and_tab.py.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ indent-style = space
2828
line-width = 88
2929
indent-width = 4
3030
quote-style = Double
31+
line-ending = LineFeed
3132
magic-trailing-comma = Respect
3233
docstring-code = Disabled
3334
preview = Disabled
@@ -59,6 +60,7 @@ indent-style = space
5960
line-width = 88
6061
indent-width = 2
6162
quote-style = Double
63+
line-ending = LineFeed
6264
magic-trailing-comma = Respect
6365
docstring-code = Disabled
6466
preview = Disabled
@@ -90,6 +92,7 @@ indent-style = tab
9092
line-width = 88
9193
indent-width = 4
9294
quote-style = Double
95+
line-ending = LineFeed
9396
magic-trailing-comma = Respect
9497
docstring-code = Disabled
9598
preview = Disabled

crates/ruff_python_formatter/tests/snapshots/[email protected]

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ indent-style = space
7979
line-width = 88
8080
indent-width = 4
8181
quote-style = Double
82+
line-ending = LineFeed
8283
magic-trailing-comma = Respect
8384
docstring-code = Disabled
8485
preview = Disabled
@@ -159,6 +160,7 @@ indent-style = space
159160
line-width = 88
160161
indent-width = 4
161162
quote-style = Double
163+
line-ending = LineFeed
162164
magic-trailing-comma = Respect
163165
docstring-code = Disabled
164166
preview = Enabled

crates/ruff_python_formatter/tests/snapshots/format@skip_magic_trailing_comma.py.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ indent-style = space
4646
line-width = 88
4747
indent-width = 4
4848
quote-style = Double
49+
line-ending = LineFeed
4950
magic-trailing-comma = Respect
5051
docstring-code = Disabled
5152
preview = Disabled
@@ -100,6 +101,7 @@ indent-style = space
100101
line-width = 88
101102
indent-width = 4
102103
quote-style = Double
104+
line-ending = LineFeed
103105
magic-trailing-comma = Ignore
104106
docstring-code = Disabled
105107
preview = Disabled

crates/ruff_python_formatter/tests/snapshots/format@tab_width.py.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ indent-style = space
2121
line-width = 88
2222
indent-width = 2
2323
quote-style = Double
24+
line-ending = LineFeed
2425
magic-trailing-comma = Respect
2526
docstring-code = Disabled
2627
preview = Disabled
@@ -44,6 +45,7 @@ indent-style = space
4445
line-width = 88
4546
indent-width = 4
4647
quote-style = Double
48+
line-ending = LineFeed
4749
magic-trailing-comma = Respect
4850
docstring-code = Disabled
4951
preview = Disabled
@@ -70,6 +72,7 @@ indent-style = space
7072
line-width = 88
7173
indent-width = 8
7274
quote-style = Double
75+
line-ending = LineFeed
7376
magic-trailing-comma = Respect
7477
docstring-code = Disabled
7578
preview = Disabled

0 commit comments

Comments
 (0)