-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ruff_python_formatter: add CRLF test
This test ensures that CRLF line endings are set correctly within a reformatted code snippet.
- Loading branch information
1 parent
06c3c22
commit 9d466b9
Showing
4 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...f_python_formatter/resources/test/fixtures/ruff/docstring_code_examples_crlf.options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ | ||
{ | ||
"docstring_code": "enabled", | ||
"indent_style": "space", | ||
"indent_width": 4, | ||
"line_ending": "CarriageReturnLineFeed" | ||
} | ||
] |
9 changes: 9 additions & 0 deletions
9
crates/ruff_python_formatter/resources/test/fixtures/ruff/docstring_code_examples_crlf.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def doctest_line_ending(): | ||
""" | ||
Do cool stuff. | ||
>>> def foo( x ): | ||
... print( x ) | ||
... | ||
... print( x ) | ||
""" | ||
pass |
44 changes: 44 additions & 0 deletions
44
crates/ruff_python_formatter/tests/snapshots/format@docstring_code_examples_crlf.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
source: crates/ruff_python_formatter/tests/fixtures.rs | ||
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/docstring_code_examples_crlf.py | ||
--- | ||
## Input | ||
```python | ||
def doctest_line_ending(): | ||
""" | ||
Do cool stuff. | ||
>>> def foo( x ): | ||
... print( x ) | ||
... | ||
... print( x ) | ||
""" | ||
pass | ||
``` | ||
|
||
## Outputs | ||
### Output 1 | ||
``` | ||
indent-style = space | ||
line-width = 88 | ||
indent-width = 4 | ||
quote-style = Double | ||
line-ending = CarriageReturnLineFeed | ||
magic-trailing-comma = Respect | ||
docstring-code = Enabled | ||
preview = Disabled | ||
``` | ||
|
||
```python | ||
def doctest_line_ending(): | ||
""" | ||
Do cool stuff. | ||
>>> def foo(x): | ||
... print(x) | ||
... | ||
... print(x) | ||
""" | ||
pass | ||
``` | ||
|
||
|
||
|