From 3b1c26d752e1f6559bf2775d1a015a33af61e92a Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Sun, 20 Aug 2017 14:47:54 +0200 Subject: [PATCH] Add (ignored) test cases for issues #75, #155, and #176 Fix a typo in TryWithResources.input and TryWithResources.output --- .../java/Java9SourceTest.java | 55 +++++++++++++++++++ .../java/testdata/TryWithResources.input | 2 +- .../java/testdata/TryWithResources.output | 2 +- 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 core/src/test/java/com/google/googlejavaformat/java/Java9SourceTest.java diff --git a/core/src/test/java/com/google/googlejavaformat/java/Java9SourceTest.java b/core/src/test/java/com/google/googlejavaformat/java/Java9SourceTest.java new file mode 100644 index 000000000..43f872362 --- /dev/null +++ b/core/src/test/java/com/google/googlejavaformat/java/Java9SourceTest.java @@ -0,0 +1,55 @@ +/* + * Copyright 2015 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.googlejavaformat.java; + +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Tests for Java 9 syntax issues. */ +@RunWith(JUnit4.class) +public class Java9SourceTest { + + @Test + @Ignore + public void issue75() throws FormatterException { + String sourceString = "module empty {}"; + new Formatter().formatSource(sourceString); + } + + @Test + @Ignore + public void issue155() throws FormatterException { + String sourceString = + "class EffectivelyFinalVariableUsedInTryWithResourcesStatement {\n" + + " void useAndClose(AutoCloseable resource) {\n" + + " try (resource) {}\n" + + " }\n" + + "}"; + new Formatter().formatSource(sourceString); + } + + @Test + @Ignore + public void issue176() throws FormatterException { + String sourceString = + "interface InterfaceWithPrivateStaticMethod {\n" + + " private static void bar() {}\n" + + " default void foo() { bar(); }\n" + + "}"; + new Formatter().formatSource(sourceString); + } +} diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/TryWithResources.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/TryWithResources.input index 5d294f94a..01a63b6d0 100644 --- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/TryWithResources.input +++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/TryWithResources.input @@ -1,4 +1,4 @@ -class TryWtihResources { +class TryWithResources { { try (@A C c = c(); ) {} try (final @A C c = c(); ) {} diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/TryWithResources.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/TryWithResources.output index 5d294f94a..01a63b6d0 100644 --- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/TryWithResources.output +++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/TryWithResources.output @@ -1,4 +1,4 @@ -class TryWtihResources { +class TryWithResources { { try (@A C c = c(); ) {} try (final @A C c = c(); ) {}