diff --git a/core/src/test/java/com/google/googlejavaformat/java/FormatterTest.java b/core/src/test/java/com/google/googlejavaformat/java/FormatterTest.java index 494c46853..f5a17df27 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/FormatterTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/FormatterTest.java @@ -1368,4 +1368,29 @@ class T { """; assertThat(new Formatter().formatSource(input)).isEqualTo(expected); } + + @Test + public void shebangComment() throws Exception { + String input = + """ + ///usr/bin/env jbang "$0" "$@" ; exit $? + + public class hello { + public static void main(String... args) { + System.out.println("Hello World"); + } + } + """; + String expected = + """ + /// usr/bin/env jbang "$0" "$@" ; exit $? + + public class hello { + public static void main(String... args) { + System.out.println("Hello World"); + } + } + """; + assertThat(new Formatter().formatSource(input)).isEqualTo(expected); + } }