From 453ad0853c766d2ea74f95341948b875570195c9 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Tue, 12 Nov 2024 16:30:43 -0800 Subject: [PATCH] Add some more test cases for pattern guards PiperOrigin-RevId: 695910986 --- .../java/testdata/SwitchGuardClause.input | 48 ++++++++++++++++++ .../java/testdata/SwitchGuardClause.output | 50 +++++++++++++++++++ 2 files changed, 98 insertions(+) diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.input index 25df58096..36eb21b16 100644 --- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.input +++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.input @@ -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 -> {} + } + } } diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.output index 25df58096..1a81422c4 100644 --- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.output +++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/SwitchGuardClause.output @@ -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 -> {} + } + } }