Skip to content

Commit

Permalink
Update package statements for testdata files to match their paths.
Browse files Browse the repository at this point in the history
MOE_MIGRATED_REVID=125807828
  • Loading branch information
eaftan authored and cushon committed Jun 25, 2016
1 parent edfe481 commit f50c93f
Show file tree
Hide file tree
Showing 186 changed files with 261 additions and 227 deletions.
Expand Up @@ -103,9 +103,11 @@ public void setUp() {

@Test
public void fileWithError() throws Exception {
Result exitCode = compiler.compile(compiler.fileManager().forResources(
BadShiftAmount.class,
"BadShiftAmountPositiveCases.java"));
Result exitCode =
compiler.compile(
compiler
.fileManager()
.forResources(BadShiftAmount.class, "testdata/BadShiftAmountPositiveCases.java"));
assertThat(outputStream.toString(), exitCode, is(Result.ERROR));

Matcher<? super Iterable<Diagnostic<? extends JavaFileObject>>> matcher = hasItem(
Expand All @@ -118,9 +120,13 @@ public void fileWithError() throws Exception {
public void fileWithWarning() throws Exception {
compilerBuilder.report(ScannerSupplier.fromBugCheckerClasses(NonAtomicVolatileUpdate.class));
compiler = compilerBuilder.build();
Result exitCode = compiler.compile(compiler.fileManager().forResources(
NonAtomicVolatileUpdate.class,
"NonAtomicVolatileUpdatePositiveCases.java"));
Result exitCode =
compiler.compile(
compiler
.fileManager()
.forResources(
NonAtomicVolatileUpdate.class,
"testdata/NonAtomicVolatileUpdatePositiveCases.java"));
assertThat(outputStream.toString(), exitCode, is(Result.OK));

Matcher<? super Iterable<Diagnostic<? extends JavaFileObject>>> matcher = hasItem(
Expand All @@ -131,17 +137,24 @@ public void fileWithWarning() throws Exception {

@Test
public void fileWithMultipleTopLevelClasses() throws Exception {
Result exitCode = compiler.compile(
compiler.fileManager().forResources(getClass(),
"MultipleTopLevelClassesWithNoErrors.java"));
Result exitCode =
compiler.compile(
compiler
.fileManager()
.forResources(getClass(), "testdata/MultipleTopLevelClassesWithNoErrors.java"));
assertThat(outputStream.toString(), exitCode, is(Result.OK));
}

@Test
public void fileWithMultipleTopLevelClassesExtends() throws Exception {
Result exitCode = compiler.compile(
compiler.fileManager().forResources(getClass(), "MultipleTopLevelClassesWithNoErrors.java",
"ExtendedMultipleTopLevelClassesWithNoErrors.java"));
Result exitCode =
compiler.compile(
compiler
.fileManager()
.forResources(
getClass(),
"testdata/MultipleTopLevelClassesWithNoErrors.java",
"testdata/ExtendedMultipleTopLevelClassesWithNoErrors.java"));
assertThat(outputStream.toString(), exitCode, is(Result.OK));
}

Expand All @@ -151,9 +164,14 @@ public void fileWithMultipleTopLevelClassesExtends() throws Exception {
*/
@Test
public void fileWithMultipleTopLevelClassesExtendsWithError() throws Exception {
Result exitCode = compiler.compile(
compiler.fileManager().forResources(getClass(), "MultipleTopLevelClassesWithErrors.java",
"ExtendedMultipleTopLevelClassesWithErrors.java"));
Result exitCode =
compiler.compile(
compiler
.fileManager()
.forResources(
getClass(),
"testdata/MultipleTopLevelClassesWithErrors.java",
"testdata/ExtendedMultipleTopLevelClassesWithErrors.java"));
assertThat(outputStream.toString(), exitCode, is(Result.ERROR));
Matcher<? super Iterable<Diagnostic<? extends JavaFileObject>>> matcher = hasItem(
diagnosticMessage(containsString("[SelfAssignment]")));
Expand All @@ -176,9 +194,14 @@ public Description matchExpressionStatement(ExpressionStatementTree tree, Visito
public void unhandledExceptionsAreReportedWithoutBugParadeLink() throws Exception {
compilerBuilder.report(ScannerSupplier.fromBugCheckerClasses(Throwing.class));
compiler = compilerBuilder.build();
Result exitCode = compiler.compile(
compiler.fileManager().forResources(getClass(), "MultipleTopLevelClassesWithErrors.java",
"ExtendedMultipleTopLevelClassesWithErrors.java"));
Result exitCode =
compiler.compile(
compiler
.fileManager()
.forResources(
getClass(),
"testdata/MultipleTopLevelClassesWithErrors.java",
"testdata/ExtendedMultipleTopLevelClassesWithErrors.java"));
assertThat(outputStream.toString(), exitCode, is(Result.ABNORMAL));
Matcher<? super Iterable<Diagnostic<? extends JavaFileObject>>> matcher = hasItem(
diagnosticMessage(CoreMatchers.<String>allOf(
Expand All @@ -195,7 +218,9 @@ public void unhandledExceptionsAreReportedWithoutBugParadeLink() throws Exceptio
public void annotationProcessingWorks() throws Exception {
Result exitCode =
compiler.compile(
compiler.fileManager().forResources(getClass(), "UsesAnnotationProcessor.java"),
compiler
.fileManager()
.forResources(getClass(), "testdata/UsesAnnotationProcessor.java"),
Arrays.asList(new NullAnnotationProcessor()));
assertThat(outputStream.toString(), exitCode, is(Result.OK));
}
Expand All @@ -205,14 +230,18 @@ public void annotationProcessingWorks() throws Exception {
*/
@Test
public void reportReadyForAnalysisOnce() throws Exception {
Result exitCode = compiler.compile(
compiler.fileManager().forResources(getClass(),
"FlowConstants.java",
"FlowSub.java",
// This order is important: the superclass needs to occur after the subclass in the
// sources so it goes through flow twice (once so it can be used when the subclass
// is desugared, once normally).
"FlowSuper.java"));
Result exitCode =
compiler.compile(
compiler
.fileManager()
.forResources(
getClass(),
"testdata/FlowConstants.java",
"testdata/FlowSub.java",
// This order is important: the superclass needs to occur after the subclass in
// the sources so it goes through flow twice (once so it can be used when the
// subclass is desugared, once normally).
"testdata/FlowSuper.java"));
assertThat(outputStream.toString(), exitCode, is(Result.OK));
}

Expand Down
Expand Up @@ -295,9 +295,10 @@ public void testSeverityResetsAfterOverride() throws Exception {
"-d", tempDir.getRoot().getAbsolutePath(),
"-proc:none",
"-Xep:ChainingConstructorIgnoresParameter:WARN");
List<JavaFileObject> sources = fileManager.forResources(
ChainingConstructorIgnoresParameter.class,
"ChainingConstructorIgnoresParameterPositiveCases.java");
List<JavaFileObject> sources =
fileManager.forResources(
ChainingConstructorIgnoresParameter.class,
"testdata/ChainingConstructorIgnoresParameterPositiveCases.java");
fileManager.close();

JavaCompiler.CompilationTask task = errorProneJavaCompiler.getTask(
Expand All @@ -316,8 +317,10 @@ public void testSeverityResetsAfterOverride() throws Exception {
// reset state between compilations
diagnosticHelper.clearDiagnostics();
fileManager = new ErrorProneInMemoryFileManager();
sources = fileManager.forResources(ChainingConstructorIgnoresParameter.class,
"ChainingConstructorIgnoresParameterPositiveCases.java");
sources =
fileManager.forResources(
ChainingConstructorIgnoresParameter.class,
"testdata/ChainingConstructorIgnoresParameterPositiveCases.java");
fileManager.close();
args.remove("-Xep:ChainingConstructorIgnoresParameter:WARN");

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns.android;
package com.google.errorprone.bugpatterns.android.testdata;

import android.app.Fragment;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns.android;
package com.google.errorprone.bugpatterns.android.testdata;

import android.app.Fragment;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns.android;
package com.google.errorprone.bugpatterns.android.testdata;

/**
* @author avenet@google.com (Arnaud J. Venet)
Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns.android;
package com.google.errorprone.bugpatterns.android.testdata;

/**
* @author avenet@google.com (Arnaud J. Venet)
Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns.android;
package com.google.errorprone.bugpatterns.android.testdata;

import android.graphics.Rect;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns.android;
package com.google.errorprone.bugpatterns.android.testdata;

import android.graphics.Rect;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns.collectionincompatibletype;
package com.google.errorprone.bugpatterns.collectionincompatibletype.testdata;

import java.util.HashMap;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns.collectionincompatibletype;
package com.google.errorprone.bugpatterns.collectionincompatibletype.testdata;

import com.google.common.base.Optional;
import com.google.common.collect.ClassToInstanceMap;
Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns.collectionincompatibletype;
package com.google.errorprone.bugpatterns.collectionincompatibletype.testdata;

import java.util.Properties;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns.collectionincompatibletype;
package com.google.errorprone.bugpatterns.collectionincompatibletype.testdata;

import com.google.common.collect.ClassToInstanceMap;

Expand Down Expand Up @@ -179,7 +179,7 @@ private static class Date {}
public boolean errorMessageUsesFullyQualifedNamesWhenSimpleNamesAreTheSame(
Collection<java.util.Date> collection1, Collection<Date> collection2) {
// BUG: Diagnostic contains: Argument 'new Date()' should not be passed to this method
// its type com.google.errorprone.bugpatterns.collectionincompatibletype.CollectionIncompatibleTypePositiveCases.Date is not compatible with its collection's type argument java.util.Date
// its type com.google.errorprone.bugpatterns.collectionincompatibletype.testdata.CollectionIncompatibleTypePositiveCases.Date is not compatible with its collection's type argument java.util.Date
return collection1.contains(new Date());
}

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns;
package com.google.errorprone.bugpatterns.testdata;

import com.google.common.base.Objects;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns;
package com.google.errorprone.bugpatterns.testdata;

import java.util.Objects;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns;
package com.google.errorprone.bugpatterns.testdata;

import com.google.common.base.Objects;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns;
package com.google.errorprone.bugpatterns.testdata;

import java.util.Objects;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns;
package com.google.errorprone.bugpatterns.testdata;

import com.google.common.base.Objects;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns;
package com.google.errorprone.bugpatterns.testdata;

import java.util.Objects;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns;
package com.google.errorprone.bugpatterns.testdata;

import com.google.common.base.Objects;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns;
package com.google.errorprone.bugpatterns.testdata;

import java.util.Objects;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns;
package com.google.errorprone.bugpatterns.testdata;

/**
* @author adgar@google.com (Mike Edgar)
Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns;
package com.google.errorprone.bugpatterns.testdata;

import java.util.*;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns;
package com.google.errorprone.bugpatterns.testdata;

/**
* @author adgar@google.com (Mike Edgar)
Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns;
package com.google.errorprone.bugpatterns.testdata;

import java.util.*;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns;
package com.google.errorprone.bugpatterns.testdata;

import java.util.*;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns;
package com.google.errorprone.bugpatterns.testdata;

import java.util.*;

Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.errorprone.bugpatterns;
package com.google.errorprone.bugpatterns.testdata;

/**
* @author sebastian.h.monte@gmail.com (Sebastian Monte)
Expand Down

0 comments on commit f50c93f

Please sign in to comment.