Skip to content

Commit

Permalink
Disinherit "tests/com/google/javascript/jscomp/....java" from `TestCa…
Browse files Browse the repository at this point in the history
…se`.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218870829
  • Loading branch information
nreid260 authored and EatingW committed Oct 30, 2018
1 parent 2247415 commit cdaddb7
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 34 deletions.
5 changes: 1 addition & 4 deletions test/com/google/javascript/jscomp/AstFactoryTest.java
Expand Up @@ -31,22 +31,19 @@
import com.google.javascript.rhino.jstype.JSTypeNative; import com.google.javascript.rhino.jstype.JSTypeNative;
import com.google.javascript.rhino.jstype.JSTypeRegistry; import com.google.javascript.rhino.jstype.JSTypeRegistry;
import com.google.javascript.rhino.jstype.ObjectType; import com.google.javascript.rhino.jstype.ObjectType;
import junit.framework.TestCase;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;


@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class AstFactoryTest extends TestCase { public class AstFactoryTest {
private static final Joiner LINE_JOINER = Joiner.on('\n'); private static final Joiner LINE_JOINER = Joiner.on('\n');


private Compiler compiler; private Compiler compiler;


@Override
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp();
compiler = new Compiler(); compiler = new Compiler();
} }


Expand Down
Expand Up @@ -26,10 +26,9 @@
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import junit.framework.TestCase;
import org.junit.Before; import org.junit.Before;


public abstract class BaseReplaceScriptTestCase extends TestCase { public abstract class BaseReplaceScriptTestCase {
protected static final Joiner LINE_JOINER = Joiner.on('\n'); protected static final Joiner LINE_JOINER = Joiner.on('\n');


protected static final String CLOSURE_BASE = protected static final String CLOSURE_BASE =
Expand Down Expand Up @@ -57,10 +56,8 @@ public abstract class BaseReplaceScriptTestCase extends TestCase {
*/ */
protected ImmutableList<SourceFile> testExterns = EXTVAR_EXTERNS; protected ImmutableList<SourceFile> testExterns = EXTVAR_EXTERNS;


@Override
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp();
testExterns = EXTVAR_EXTERNS; testExterns = EXTVAR_EXTERNS;
} }


Expand Down
6 changes: 3 additions & 3 deletions test/com/google/javascript/jscomp/ChangeVerifierTest.java
Expand Up @@ -22,13 +22,12 @@


import com.google.javascript.rhino.IR; import com.google.javascript.rhino.IR;
import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Node;
import junit.framework.TestCase;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;


@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public final class ChangeVerifierTest extends TestCase { public final class ChangeVerifierTest {


@Test @Test
public void testCorrectValidationOfScriptWithChangeAfterFunction() { public void testCorrectValidationOfScriptWithChangeAfterFunction() {
Expand Down Expand Up @@ -131,7 +130,8 @@ public void testNotDeletedFunction() {
} }
} }


public static void testChangeVerification() { @Test
public void testChangeVerification() {
Compiler compiler = new Compiler(); Compiler compiler = new Compiler();


Node mainScript = IR.script(); Node mainScript = IR.script();
Expand Down
Expand Up @@ -23,7 +23,6 @@
import com.google.javascript.jscomp.graph.DiGraph; import com.google.javascript.jscomp.graph.DiGraph;
import com.google.javascript.jscomp.graph.DiGraph.DiGraphEdge; import com.google.javascript.jscomp.graph.DiGraph.DiGraphEdge;
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; import com.google.javascript.jscomp.graph.LinkedDirectedGraph;
import junit.framework.TestCase;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
Expand All @@ -33,7 +32,7 @@
* *
*/ */
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public final class CheckPathsBetweenNodesTest extends TestCase { public final class CheckPathsBetweenNodesTest {


/** /**
* Predicate satisfied by strings with a given prefix. * Predicate satisfied by strings with a given prefix.
Expand Down
3 changes: 1 addition & 2 deletions test/com/google/javascript/jscomp/CleanupPassesTest.java
Expand Up @@ -19,14 +19,13 @@
import static com.google.common.truth.Truth.assertWithMessage; import static com.google.common.truth.Truth.assertWithMessage;


import java.util.List; import java.util.List;
import junit.framework.TestCase;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;


/** @author tylerg@google.com (Tyler Goodwin) */ /** @author tylerg@google.com (Tyler Goodwin) */
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public final class CleanupPassesTest extends TestCase { public final class CleanupPassesTest {


private final AbstractCompiler compiler = new Compiler(); private final AbstractCompiler compiler = new Compiler();
private final CompilerOptions options = new CompilerOptions(); private final CompilerOptions options = new CompilerOptions();
Expand Down
Expand Up @@ -25,14 +25,13 @@
import com.google.javascript.rhino.jstype.FunctionType; import com.google.javascript.rhino.jstype.FunctionType;
import com.google.javascript.rhino.jstype.JSTypeRegistry; import com.google.javascript.rhino.jstype.JSTypeRegistry;
import com.google.javascript.rhino.jstype.NominalTypeBuilderOti; import com.google.javascript.rhino.jstype.NominalTypeBuilderOti;
import junit.framework.TestCase;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;


/** Test class for {@link GoogleCodingConvention}. */ /** Test class for {@link GoogleCodingConvention}. */
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public final class ClosureCodingConventionTest extends TestCase { public final class ClosureCodingConventionTest {
private final ClosureCodingConvention conv = new ClosureCodingConvention(); private final ClosureCodingConvention conv = new ClosureCodingConvention();


@Test @Test
Expand Down
Expand Up @@ -19,6 +19,7 @@


import com.google.javascript.jscomp.CompilerOptions.LanguageMode; import com.google.javascript.jscomp.CompilerOptions.LanguageMode;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
Expand Down Expand Up @@ -72,7 +73,9 @@ public void testFunctionParamDeclaration_defaultValue() {
assertPrettyPrintSame("function foo(x: string = 'hello') {\n}"); assertPrettyPrintSame("function foo(x: string = 'hello') {\n}");
} }


public void disabled_testFunctionParamDeclaration_arrow() { @Test
@Ignore
public void testFunctionParamDeclaration_arrow() {
assertPrettyPrintSame("(x: string) => 'hello' + x;"); assertPrettyPrintSame("(x: string) => 'hello' + x;");
} }


Expand All @@ -81,7 +84,9 @@ public void testFunctionReturn() {
assertPrettyPrintSame("function foo(): string {\n return 'hello';\n}"); assertPrettyPrintSame("function foo(): string {\n return 'hello';\n}");
} }


public void disabled_testFunctionReturn_arrow() { @Test
@Ignore
public void testFunctionReturn_arrow() {
assertPrettyPrintSame("(): string => 'hello';"); assertPrettyPrintSame("(): string => 'hello';");
} }


Expand Down
26 changes: 15 additions & 11 deletions test/com/google/javascript/jscomp/CodePrinterTest.java
Expand Up @@ -1793,20 +1793,24 @@ void setOptions(CompilerOptions options) {
} }


private void assertTypeAnnotations(String js, String expected) { private void assertTypeAnnotations(String js, String expected) {
assertEquals( String actual =
expected,
new CodePrinter.Builder(parse(js, /* typeChecked= */ true)) new CodePrinter.Builder(parse(js, /* typeChecked= */ true))
.setCompilerOptions(newCompilerOptions(new CompilerOptionBuilder() { .setCompilerOptions(
@Override newCompilerOptions(
void setOptions(CompilerOptions options) { new CompilerOptionBuilder() {
options.setPrettyPrint(true); @Override
options.setLineBreak(false); void setOptions(CompilerOptions options) {
options.setLineLengthThreshold(CompilerOptions.DEFAULT_LINE_LENGTH_THRESHOLD); options.setPrettyPrint(true);
} options.setLineBreak(false);
})) options.setLineLengthThreshold(
CompilerOptions.DEFAULT_LINE_LENGTH_THRESHOLD);
}
}))
.setOutputTypes(true) .setOutputTypes(true)
.setTypeRegistry(lastCompiler.getTypeRegistry()) .setTypeRegistry(lastCompiler.getTypeRegistry())
.build()); .build();

assertThat(actual).isEqualTo(expected);
} }


@Test @Test
Expand Down
5 changes: 1 addition & 4 deletions test/com/google/javascript/jscomp/CodePrinterTestBase.java
Expand Up @@ -21,11 +21,10 @@
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.javascript.jscomp.CompilerOptions.LanguageMode; import com.google.javascript.jscomp.CompilerOptions.LanguageMode;
import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Node;
import junit.framework.TestCase;
import org.junit.Before; import org.junit.Before;


/** Base class for tests that exercise {@link CodePrinter}. */ /** Base class for tests that exercise {@link CodePrinter}. */
public abstract class CodePrinterTestBase extends TestCase { public abstract class CodePrinterTestBase {
// If this is set, ignore parse warnings and only fail the test // If this is set, ignore parse warnings and only fail the test
// for parse errors. // for parse errors.
protected boolean allowWarnings = false; protected boolean allowWarnings = false;
Expand All @@ -34,10 +33,8 @@ public abstract class CodePrinterTestBase extends TestCase {
protected LanguageMode languageMode = LanguageMode.ECMASCRIPT5; protected LanguageMode languageMode = LanguageMode.ECMASCRIPT5;
protected Compiler lastCompiler = null; protected Compiler lastCompiler = null;


@Override
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp();
allowWarnings = false; allowWarnings = false;
preserveTypeAnnotations = false; preserveTypeAnnotations = false;
trustedStrings = true; trustedStrings = true;
Expand Down

0 comments on commit cdaddb7

Please sign in to comment.