Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package com.google.googlejavaformat.java;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static com.google.common.truth.TruthJUnit.assume;
import static java.nio.charset.StandardCharsets.UTF_8;

Expand Down Expand Up @@ -915,16 +916,15 @@ class Test {}
}

@Test
public void brAtSignBug() {
public void brAtSignBug() throws FormatterException {
/*
* This is a bug -- more of a "spec" bug than an implementation bug, and hard to fix.
* Fortunately, some very quick searching didn't turn up any instances in the Google codebase.
*/
@SuppressWarnings("MisleadingEscapedSpace") // TODO(b/496180372): remove
String input =
"""
/**
* abc<br>@foo\s
* abc<br>@foo
*/
class Test {}\
""";
Expand All @@ -936,7 +936,9 @@ class Test {}\
*/
class Test {}
""";
doFormatTest(input, expected);
assertThat(formatter.formatSource(input)).isEqualTo(expected);
// This one is not idempotent since a second formatting round will introduce a blank line before
// the fake @foo tag. But the test is showing that there's a bug anyway.
}

@Test
Expand Down Expand Up @@ -2051,6 +2053,8 @@ private void doFormatTest(String input, String expected) {
try {
String actual = formatter.formatSource(input);
assertThat(actual).isEqualTo(expected);
String reformatted = formatter.formatSource(actual);
assertWithMessage("When checking idempotency").that(reformatted).isEqualTo(actual);
} catch (FormatterException e) {
throw new AssertionError(e);
}
Expand Down
Loading