Skip to content

Commit

Permalink
Add some more test cases for pattern guards
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 695910986
  • Loading branch information
cushon authored and google-java-format Team committed Nov 13, 2024
1 parent e35f60e commit 453ad08
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,52 @@ class SwitchGuardClause {
default -> true;
};
}

{
switch (o) {
case TypeWithVeryVeryVeryVeryLongName variableWithVeryLongName when variableWithVeryLongName
.methodWithVeryVeryVeryVeryLongNameReturnThis()
.methodWithVeryVeryVeryVeryLongNameReturnBoolean() -> {
System.err.println();
}
default -> {}
}
switch (o) {
case TypeWithVeryVeryVeryVeryLongName
variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName when variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName
.methodWithVeryVeryVeryVeryLongNameReturnThis()
.methodWithVeryVeryVeryVeryLongNameReturnBoolean() -> {
System.err.println();
}
default -> {}
}
switch (o) {
case TypeWithVeryVeryVeryVeryLongName variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName
when variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName
.methodWithVeryVeryVeryVeryLongNameReturnThis()
.methodWithVeryVeryVeryVeryLongNameReturnBoolean() -> {
System.err.println();
}
default -> {}
}
switch (o) {
case TypeWithVeryVeryVeryVeryLongName variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName,
TypeWithVeryVeryVeryVeryLongName variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName
when variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName
.methodWithVeryVeryVeryVeryLongNameReturnThis()
.methodWithVeryVeryVeryVeryLongNameReturnBoolean() -> {
System.err.println();
}
default -> {}
}
switch (o) {
case TypeWithVeryVeryVeryVeryLongName variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName,
TypeWithVeryVeryVeryVeryLongName variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName
when variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName
.methodWithVeryVeryVeryVeryLongNameReturnThis()
.methodWithVeryVeryVeryVeryLongNameReturnBoolean() ->
System.err.println();
default -> {}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,54 @@ class SwitchGuardClause {
default -> true;
};
}

{
switch (o) {
case TypeWithVeryVeryVeryVeryLongName variableWithVeryLongName when variableWithVeryLongName
.methodWithVeryVeryVeryVeryLongNameReturnThis()
.methodWithVeryVeryVeryVeryLongNameReturnBoolean() -> {
System.err.println();
}
default -> {}
}
switch (o) {
case TypeWithVeryVeryVeryVeryLongName
variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName when variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName
.methodWithVeryVeryVeryVeryLongNameReturnThis()
.methodWithVeryVeryVeryVeryLongNameReturnBoolean() -> {
System.err.println();
}
default -> {}
}
switch (o) {
case TypeWithVeryVeryVeryVeryLongName
variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName when variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName
.methodWithVeryVeryVeryVeryLongNameReturnThis()
.methodWithVeryVeryVeryVeryLongNameReturnBoolean() -> {
System.err.println();
}
default -> {}
}
switch (o) {
case TypeWithVeryVeryVeryVeryLongName
variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName,
TypeWithVeryVeryVeryVeryLongName
variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName when variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName
.methodWithVeryVeryVeryVeryLongNameReturnThis()
.methodWithVeryVeryVeryVeryLongNameReturnBoolean() -> {
System.err.println();
}
default -> {}
}
switch (o) {
case TypeWithVeryVeryVeryVeryLongName
variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName,
TypeWithVeryVeryVeryVeryLongName
variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName when variableWithVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName
.methodWithVeryVeryVeryVeryLongNameReturnThis()
.methodWithVeryVeryVeryVeryLongNameReturnBoolean() ->
System.err.println();
default -> {}
}
}
}

0 comments on commit 453ad08

Please sign in to comment.