Skip to content

Commit

Permalink
Regression test for eclipse-jdt/eclipse.jdt#59
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanth-sankaran committed Oct 2, 2023
1 parent fe0f7f6 commit cdfc5c5
Showing 1 changed file with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16223,4 +16223,46 @@ public void testBug564052() {
" C3 {\n" +
"}");
}

/**
* https://github.com/eclipse-jdt/eclipse.jdt/issues/59 - Formatter support for guard expressions
*/
public void testGH59() {
setComplianceLevel(CompilerOptions.VERSION_21);

String source =
"""
public class JunkClass {
Object myObj;

void foo() {
when(myObj);
foo(myObj);
foo(myObj);
}

void foo( Object stuff ) {}
void when( Object methodCall ) {}
}
""";
formatSource(source,
"""
public class JunkClass {
Object myObj;

void foo() {
when(myObj);
foo(myObj);
foo(myObj);
}

void foo(Object stuff) {
}

void when(Object methodCall) {
}
}
""");
}

}

0 comments on commit cdfc5c5

Please sign in to comment.