Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly format multiple function calls in expression #71

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/test_formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ def test_format_comment_separator(self):
self._format(code.encode()).decode().splitlines(), expected.splitlines()
)

def test_multiple_function_calls(self):
"""Validates correct line break when a expression with function calls
need to be broken. This is a regression test for #69."""
code = "f(x) " + "+ f(x)" * 20 + ";"
formatted = self._format(code.encode()).decode()
self.assertTrue(
formatted.splitlines()[0].endswith("("),
"expression should not break function calls across lines",
)


class TestFormattingErrors(unittest.TestCase):
def _format(self, content):
Expand Down
2 changes: 1 addition & 1 deletion tree-sitter-zeek
Loading