Add formatting for StmtMatch (#6286)

## Summary

This PR adds support for `StmtMatch` with subs for `MatchCase`.

## Test Plan

Add a few additional test cases around `match` statement, comments, line
breaks.

resolves: #6298
This commit is contained in:
Dhruv Manilawala 2023-08-08 18:48:49 +05:30 committed by GitHub
parent 87984e9ac7
commit 001aa486df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 882 additions and 444 deletions

View file

@ -0,0 +1,57 @@
# leading match comment
match foo: # dangling match comment
case "bar":
pass
# leading match comment
match ( # leading expr comment
# another leading expr comment
foo # trailing expr comment
# another trailing expr comment
): # dangling match comment
case "bar":
pass
# leading match comment
match ( # hello
foo # trailing expr comment
, # another
): # dangling match comment
case "bar":
pass
match [ # comment
first,
second,
third
]: # another comment
case ["a", "b", "c"]:
pass
match ( # comment
"a b c"
).split(): # another comment
case ["a", "b", "c"]:
pass
match ( # comment
# let's go
yield foo
): # another comment
case ["a", "b", "c"]:
pass
match aaaaaaaaahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh: # comment
case "sshhhhhhhh":
pass
def foo():
match inside_func: # comment
case "bar":
pass