diff --git a/compiler/tests/org/jetbrains/jet/parsing/JetParsingTest.java b/compiler/tests/org/jetbrains/jet/parsing/AbstractJetParsingTest.java similarity index 51% rename from compiler/tests/org/jetbrains/jet/parsing/JetParsingTest.java rename to compiler/tests/org/jetbrains/jet/parsing/AbstractJetParsingTest.java index 31a2a7fc8ab..7612b109264 100644 --- a/compiler/tests/org/jetbrains/jet/parsing/JetParsingTest.java +++ b/compiler/tests/org/jetbrains/jet/parsing/AbstractJetParsingTest.java @@ -16,16 +16,11 @@ package org.jetbrains.jet.parsing; -import com.intellij.openapi.application.PathManager; import com.intellij.openapi.util.io.FileUtil; import com.intellij.psi.PsiErrorElement; -import com.intellij.psi.PsiFile; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.testFramework.ParsingTestCase; -import com.intellij.vcsUtil.VcsFileUtil; -import junit.framework.Test; -import junit.framework.TestSuite; -import org.jetbrains.annotations.NonNls; +import com.intellij.util.PathUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.JetTestCaseBuilder; import org.jetbrains.jet.lang.parsing.JetParserDefinition; @@ -33,60 +28,26 @@ import org.jetbrains.jet.lang.psi.IfNotParsed; import org.jetbrains.jet.lang.psi.JetElement; import org.jetbrains.jet.lang.psi.JetVisitorVoid; -import java.io.File; import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -public class JetParsingTest extends ParsingTestCase { +public abstract class AbstractJetParsingTest extends ParsingTestCase { static { System.setProperty("idea.platform.prefix", "Idea"); } - private final String name; - - public JetParsingTest(@NotNull File file) { - super(VcsFileUtil.relativePath(new File(getPsiTestDataDir()), file.getParentFile()), file.getName().replaceFirst(".*\\.", ""), new JetParserDefinition()); - this.name = file.getName().replaceFirst("\\.[^.]*$", ""); - } - @Override protected String getTestDataPath() { - return getPsiTestDataDir(); + return JetTestCaseBuilder.getHomeDirectory(); } - private static String getPsiTestDataDir() { - return getTestDataDir() + "/psi"; + public AbstractJetParsingTest() { + super(".", "jet", new JetParserDefinition()); } - public static String getTestDataDir() { - return getHomeDirectory() + "/compiler/testData"; - } - - private static String getHomeDirectory() { - File root = new File(PathManager.getResourceRoot(JetParsingTest.class, "/org/jetbrains/jet/parsing/JetParsingTest.class")); - return FileUtil.toSystemIndependentName(root.getParentFile().getParentFile().getParent()); - } - - @Override - protected void checkResult(@NonNls String targetDataName, PsiFile file) throws IOException { - file.acceptChildren(new JetVisitorVoid() { - @Override - public void visitJetElement(JetElement element) { - element.acceptChildren(this); - try { - checkPsiGetters(element); - } catch (Throwable throwable) { - throw new RuntimeException(throwable); - } - } - }); - - super.checkResult(targetDataName, file); - } - - private void checkPsiGetters(JetElement elem) throws Throwable { + private static void checkPsiGetters(JetElement elem) throws Throwable { Method[] methods = elem.getClass().getDeclaredMethods(); for (Method method : methods) { String methodName = method.getName(); @@ -111,34 +72,22 @@ public class JetParsingTest extends ParsingTestCase { } } - @Override - protected void runTest() throws Throwable { - doTest(true); - } + protected void doParsingTest(@NotNull String filePath) throws Exception { + myFile = createPsiFile(FileUtil.getNameWithoutExtension(PathUtil.getFileName(filePath)), loadFile(filePath)); - @Override - public String getName() { - return "test" + name; - } - - public static TestSuite suite() { - TestSuite suite = new TestSuite(); - JetTestCaseBuilder.NamedTestFactory factory = new JetTestCaseBuilder.NamedTestFactory() { - @NotNull + myFile.acceptChildren(new JetVisitorVoid() { @Override - public Test createTest(@NotNull String dataPath, @NotNull String name, @NotNull File file) { - return new JetParsingTest(file); + public void visitJetElement(JetElement element) { + element.acceptChildren(this); + try { + checkPsiGetters(element); + } + catch (Throwable throwable) { + throw new RuntimeException(throwable); + } } - }; - String prefix = JetParsingTest.getTestDataDir() + "/psi/"; - suite.addTest(JetTestCaseBuilder.suiteForDirectory(prefix, "/", false, factory)); - suite.addTest(JetTestCaseBuilder.suiteForDirectory(prefix, "examples", true, factory)); - suite.addTest(JetTestCaseBuilder.suiteForDirectory(prefix, "greatSyntacticShift", true, factory)); - suite.addTest(JetTestCaseBuilder.suiteForDirectory(prefix, "script", true, factory)); - suite.addTest(JetTestCaseBuilder.suiteForDirectory(prefix, "recovery", true, factory)); - suite.addTest(JetTestCaseBuilder.suiteForDirectory(prefix, "propertyDelegate", true, factory)); - suite.addTest(JetTestCaseBuilder.suiteForDirectory(prefix, "kdoc", true, factory)); - return suite; - } + }); + doCheckResult(myFullDataPath, filePath.replace(".jet", ".txt"), toParseTreeText(myFile, false, false).trim()); + } } diff --git a/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java b/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java new file mode 100644 index 00000000000..cae148bb43b --- /dev/null +++ b/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java @@ -0,0 +1,790 @@ +/* + * Copyright 2010-2013 JetBrains s.r.o. + * + * 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 org.jetbrains.jet.parsing; + +import junit.framework.Assert; +import junit.framework.Test; +import junit.framework.TestSuite; + +import java.io.File; +import java.util.regex.Pattern; +import org.jetbrains.jet.JetTestUtils; +import org.jetbrains.jet.test.InnerTestClasses; +import org.jetbrains.jet.test.TestMetadata; + +import org.jetbrains.jet.parsing.AbstractJetParsingTest; + +/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/psi") +@InnerTestClasses({JetParsingTestGenerated.Examples.class, JetParsingTestGenerated.FunctionReceivers.class, JetParsingTestGenerated.GreatSyntacticShift.class, JetParsingTestGenerated.Kdoc.class, JetParsingTestGenerated.Recovery.class}) +public class JetParsingTestGenerated extends AbstractJetParsingTest { + public void testAllFilesPresentInPsi() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi"), Pattern.compile("^(.+)\\.jet$"), true); + } + + @TestMetadata("AnnotatedExpressions.jet") + public void testAnnotatedExpressions() throws Exception { + doParsingTest("compiler/testData/psi/AnnotatedExpressions.jet"); + } + + @TestMetadata("AnonymousInitializer.jet") + public void testAnonymousInitializer() throws Exception { + doParsingTest("compiler/testData/psi/AnonymousInitializer.jet"); + } + + @TestMetadata("AssertNotNull.jet") + public void testAssertNotNull() throws Exception { + doParsingTest("compiler/testData/psi/AssertNotNull.jet"); + } + + @TestMetadata("Attributes.jet") + public void testAttributes() throws Exception { + doParsingTest("compiler/testData/psi/Attributes.jet"); + } + + @TestMetadata("AttributesOnPatterns.jet") + public void testAttributesOnPatterns() throws Exception { + doParsingTest("compiler/testData/psi/AttributesOnPatterns.jet"); + } + + @TestMetadata("Attributes_ERR.jet") + public void testAttributes_ERR() throws Exception { + doParsingTest("compiler/testData/psi/Attributes_ERR.jet"); + } + + @TestMetadata("BabySteps.jet") + public void testBabySteps() throws Exception { + doParsingTest("compiler/testData/psi/BabySteps.jet"); + } + + @TestMetadata("BabySteps_ERR.jet") + public void testBabySteps_ERR() throws Exception { + doParsingTest("compiler/testData/psi/BabySteps_ERR.jet"); + } + + @TestMetadata("BlockCommentAtBeginningOfFile1.jet") + public void testBlockCommentAtBeginningOfFile1() throws Exception { + doParsingTest("compiler/testData/psi/BlockCommentAtBeginningOfFile1.jet"); + } + + @TestMetadata("BlockCommentAtBeginningOfFile2.jet") + public void testBlockCommentAtBeginningOfFile2() throws Exception { + doParsingTest("compiler/testData/psi/BlockCommentAtBeginningOfFile2.jet"); + } + + @TestMetadata("BlockCommentAtBeginningOfFile3.jet") + public void testBlockCommentAtBeginningOfFile3() throws Exception { + doParsingTest("compiler/testData/psi/BlockCommentAtBeginningOfFile3.jet"); + } + + @TestMetadata("BlockCommentAtBeginningOfFile4.jet") + public void testBlockCommentAtBeginningOfFile4() throws Exception { + doParsingTest("compiler/testData/psi/BlockCommentAtBeginningOfFile4.jet"); + } + + @TestMetadata("ByCaluses.jet") + public void testByCaluses() throws Exception { + doParsingTest("compiler/testData/psi/ByCaluses.jet"); + } + + @TestMetadata("CallWithManyClosures.jet") + public void testCallWithManyClosures() throws Exception { + doParsingTest("compiler/testData/psi/CallWithManyClosures.jet"); + } + + @TestMetadata("CallsInWhen.jet") + public void testCallsInWhen() throws Exception { + doParsingTest("compiler/testData/psi/CallsInWhen.jet"); + } + + @TestMetadata("Constructors.jet") + public void testConstructors() throws Exception { + doParsingTest("compiler/testData/psi/Constructors.jet"); + } + + @TestMetadata("ControlStructures.jet") + public void testControlStructures() throws Exception { + doParsingTest("compiler/testData/psi/ControlStructures.jet"); + } + + @TestMetadata("DoubleColon.jet") + public void testDoubleColon() throws Exception { + doParsingTest("compiler/testData/psi/DoubleColon.jet"); + } + + @TestMetadata("EOLsInComments.jet") + public void testEOLsInComments() throws Exception { + doParsingTest("compiler/testData/psi/EOLsInComments.jet"); + } + + @TestMetadata("EOLsOnRollback.jet") + public void testEOLsOnRollback() throws Exception { + doParsingTest("compiler/testData/psi/EOLsOnRollback.jet"); + } + + @TestMetadata("EmptyFile.jet") + public void testEmptyFile() throws Exception { + doParsingTest("compiler/testData/psi/EmptyFile.jet"); + } + + @TestMetadata("Enums.jet") + public void testEnums() throws Exception { + doParsingTest("compiler/testData/psi/Enums.jet"); + } + + @TestMetadata("Expressions_ERR.jet") + public void testExpressions_ERR() throws Exception { + doParsingTest("compiler/testData/psi/Expressions_ERR.jet"); + } + + @TestMetadata("ExtensionsWithQNReceiver.jet") + public void testExtensionsWithQNReceiver() throws Exception { + doParsingTest("compiler/testData/psi/ExtensionsWithQNReceiver.jet"); + } + + @TestMetadata("FileStart_ERR.jet") + public void testFileStart_ERR() throws Exception { + doParsingTest("compiler/testData/psi/FileStart_ERR.jet"); + } + + @TestMetadata("ForWithMultiDecl.jet") + public void testForWithMultiDecl() throws Exception { + doParsingTest("compiler/testData/psi/ForWithMultiDecl.jet"); + } + + @TestMetadata("FunctionCalls.jet") + public void testFunctionCalls() throws Exception { + doParsingTest("compiler/testData/psi/FunctionCalls.jet"); + } + + @TestMetadata("FunctionLiterals.jet") + public void testFunctionLiterals() throws Exception { + doParsingTest("compiler/testData/psi/FunctionLiterals.jet"); + } + + @TestMetadata("FunctionLiterals_ERR.jet") + public void testFunctionLiterals_ERR() throws Exception { + doParsingTest("compiler/testData/psi/FunctionLiterals_ERR.jet"); + } + + @TestMetadata("FunctionTypes.jet") + public void testFunctionTypes() throws Exception { + doParsingTest("compiler/testData/psi/FunctionTypes.jet"); + } + + @TestMetadata("FunctionTypes_ERR.jet") + public void testFunctionTypes_ERR() throws Exception { + doParsingTest("compiler/testData/psi/FunctionTypes_ERR.jet"); + } + + @TestMetadata("Functions.jet") + public void testFunctions() throws Exception { + doParsingTest("compiler/testData/psi/Functions.jet"); + } + + @TestMetadata("Functions_ERR.jet") + public void testFunctions_ERR() throws Exception { + doParsingTest("compiler/testData/psi/Functions_ERR.jet"); + } + + @TestMetadata("HangOnLonelyModifier.jet") + public void testHangOnLonelyModifier() throws Exception { + doParsingTest("compiler/testData/psi/HangOnLonelyModifier.jet"); + } + + @TestMetadata("IfWithPropery.jet") + public void testIfWithPropery() throws Exception { + doParsingTest("compiler/testData/psi/IfWithPropery.jet"); + } + + @TestMetadata("ImportSoftKW.jet") + public void testImportSoftKW() throws Exception { + doParsingTest("compiler/testData/psi/ImportSoftKW.jet"); + } + + @TestMetadata("Imports.jet") + public void testImports() throws Exception { + doParsingTest("compiler/testData/psi/Imports.jet"); + } + + @TestMetadata("Imports_ERR.jet") + public void testImports_ERR() throws Exception { + doParsingTest("compiler/testData/psi/Imports_ERR.jet"); + } + + @TestMetadata("Inner.jet") + public void testInner() throws Exception { + doParsingTest("compiler/testData/psi/Inner.jet"); + } + + @TestMetadata("Labels.jet") + public void testLabels() throws Exception { + doParsingTest("compiler/testData/psi/Labels.jet"); + } + + @TestMetadata("LocalDeclarations.jet") + public void testLocalDeclarations() throws Exception { + doParsingTest("compiler/testData/psi/LocalDeclarations.jet"); + } + + @TestMetadata("ModifierAsSelector.jet") + public void testModifierAsSelector() throws Exception { + doParsingTest("compiler/testData/psi/ModifierAsSelector.jet"); + } + + @TestMetadata("MultiVariableDeclarations.jet") + public void testMultiVariableDeclarations() throws Exception { + doParsingTest("compiler/testData/psi/MultiVariableDeclarations.jet"); + } + + @TestMetadata("NamespaceBlockFirst.jet") + public void testNamespaceBlockFirst() throws Exception { + doParsingTest("compiler/testData/psi/NamespaceBlockFirst.jet"); + } + + @TestMetadata("NamespaceModifiers.jet") + public void testNamespaceModifiers() throws Exception { + doParsingTest("compiler/testData/psi/NamespaceModifiers.jet"); + } + + @TestMetadata("NestedComments.jet") + public void testNestedComments() throws Exception { + doParsingTest("compiler/testData/psi/NestedComments.jet"); + } + + @TestMetadata("NewLinesValidOperations.jet") + public void testNewLinesValidOperations() throws Exception { + doParsingTest("compiler/testData/psi/NewLinesValidOperations.jet"); + } + + @TestMetadata("NewlinesInParentheses.jet") + public void testNewlinesInParentheses() throws Exception { + doParsingTest("compiler/testData/psi/NewlinesInParentheses.jet"); + } + + @TestMetadata("NotIsAndNotIn.jet") + public void testNotIsAndNotIn() throws Exception { + doParsingTest("compiler/testData/psi/NotIsAndNotIn.jet"); + } + + @TestMetadata("ObjectLiteralAsStatement.jet") + public void testObjectLiteralAsStatement() throws Exception { + doParsingTest("compiler/testData/psi/ObjectLiteralAsStatement.jet"); + } + + @TestMetadata("Precedence.jet") + public void testPrecedence() throws Exception { + doParsingTest("compiler/testData/psi/Precedence.jet"); + } + + @TestMetadata("PrimaryConstructorModifiers_ERR.jet") + public void testPrimaryConstructorModifiers_ERR() throws Exception { + doParsingTest("compiler/testData/psi/PrimaryConstructorModifiers_ERR.jet"); + } + + @TestMetadata("Properties.jet") + public void testProperties() throws Exception { + doParsingTest("compiler/testData/psi/Properties.jet"); + } + + @TestMetadata("PropertiesFollowedByInitializers.jet") + public void testPropertiesFollowedByInitializers() throws Exception { + doParsingTest("compiler/testData/psi/PropertiesFollowedByInitializers.jet"); + } + + @TestMetadata("Properties_ERR.jet") + public void testProperties_ERR() throws Exception { + doParsingTest("compiler/testData/psi/Properties_ERR.jet"); + } + + @TestMetadata("QuotedIdentifiers.jet") + public void testQuotedIdentifiers() throws Exception { + doParsingTest("compiler/testData/psi/QuotedIdentifiers.jet"); + } + + @TestMetadata("RootNamespace.jet") + public void testRootNamespace() throws Exception { + doParsingTest("compiler/testData/psi/RootNamespace.jet"); + } + + @TestMetadata("SemicolonAfterIf.jet") + public void testSemicolonAfterIf() throws Exception { + doParsingTest("compiler/testData/psi/SemicolonAfterIf.jet"); + } + + @TestMetadata("ShortAnnotations.jet") + public void testShortAnnotations() throws Exception { + doParsingTest("compiler/testData/psi/ShortAnnotations.jet"); + } + + @TestMetadata("SimpleClassMembers.jet") + public void testSimpleClassMembers() throws Exception { + doParsingTest("compiler/testData/psi/SimpleClassMembers.jet"); + } + + @TestMetadata("SimpleClassMembers_ERR.jet") + public void testSimpleClassMembers_ERR() throws Exception { + doParsingTest("compiler/testData/psi/SimpleClassMembers_ERR.jet"); + } + + @TestMetadata("SimpleExpressions.jet") + public void testSimpleExpressions() throws Exception { + doParsingTest("compiler/testData/psi/SimpleExpressions.jet"); + } + + @TestMetadata("SimpleModifiers.jet") + public void testSimpleModifiers() throws Exception { + doParsingTest("compiler/testData/psi/SimpleModifiers.jet"); + } + + @TestMetadata("SoftKeywords.jet") + public void testSoftKeywords() throws Exception { + doParsingTest("compiler/testData/psi/SoftKeywords.jet"); + } + + @TestMetadata("SoftKeywordsInTypeArguments.jet") + public void testSoftKeywordsInTypeArguments() throws Exception { + doParsingTest("compiler/testData/psi/SoftKeywordsInTypeArguments.jet"); + } + + @TestMetadata("StringTemplates.jet") + public void testStringTemplates() throws Exception { + doParsingTest("compiler/testData/psi/StringTemplates.jet"); + } + + @TestMetadata("Super.jet") + public void testSuper() throws Exception { + doParsingTest("compiler/testData/psi/Super.jet"); + } + + @TestMetadata("ThisType.jet") + public void testThisType() throws Exception { + doParsingTest("compiler/testData/psi/ThisType.jet"); + } + + @TestMetadata("TryRecovery.jet") + public void testTryRecovery() throws Exception { + doParsingTest("compiler/testData/psi/TryRecovery.jet"); + } + + @TestMetadata("TypeAnnotations.jet") + public void testTypeAnnotations() throws Exception { + doParsingTest("compiler/testData/psi/TypeAnnotations.jet"); + } + + @TestMetadata("TypeConstraints.jet") + public void testTypeConstraints() throws Exception { + doParsingTest("compiler/testData/psi/TypeConstraints.jet"); + } + + @TestMetadata("TypeDef.jet") + public void testTypeDef() throws Exception { + doParsingTest("compiler/testData/psi/TypeDef.jet"); + } + + @TestMetadata("TypeDef_ERR.jet") + public void testTypeDef_ERR() throws Exception { + doParsingTest("compiler/testData/psi/TypeDef_ERR.jet"); + } + + @TestMetadata("TypeExpressionAmbiguities_ERR.jet") + public void testTypeExpressionAmbiguities_ERR() throws Exception { + doParsingTest("compiler/testData/psi/TypeExpressionAmbiguities_ERR.jet"); + } + + @TestMetadata("TypeParametersBeforeName.jet") + public void testTypeParametersBeforeName() throws Exception { + doParsingTest("compiler/testData/psi/TypeParametersBeforeName.jet"); + } + + @TestMetadata("When.jet") + public void testWhen() throws Exception { + doParsingTest("compiler/testData/psi/When.jet"); + } + + @TestMetadata("When_ERR.jet") + public void testWhen_ERR() throws Exception { + doParsingTest("compiler/testData/psi/When_ERR.jet"); + } + + @TestMetadata("compiler/testData/psi/examples") + @InnerTestClasses({Examples.Array.class, Examples.Collections.class, Examples.Io.class, Examples.Map.class, Examples.Priorityqueues.class, Examples.Util.class}) + public static class Examples extends AbstractJetParsingTest { + public void testAllFilesPresentInExamples() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/examples"), Pattern.compile("^(.+)\\.jet$"), true); + } + + @TestMetadata("AnonymousObjects.jet") + public void testAnonymousObjects() throws Exception { + doParsingTest("compiler/testData/psi/examples/AnonymousObjects.jet"); + } + + @TestMetadata("BinaryTree.jet") + public void testBinaryTree() throws Exception { + doParsingTest("compiler/testData/psi/examples/BinaryTree.jet"); + } + + @TestMetadata("BitArith.jet") + public void testBitArith() throws Exception { + doParsingTest("compiler/testData/psi/examples/BitArith.jet"); + } + + @TestMetadata("Builder.jet") + public void testBuilder() throws Exception { + doParsingTest("compiler/testData/psi/examples/Builder.jet"); + } + + @TestMetadata("Color.jet") + public void testColor() throws Exception { + doParsingTest("compiler/testData/psi/examples/Color.jet"); + } + + @TestMetadata("FunctionsAndTypes.jet") + public void testFunctionsAndTypes() throws Exception { + doParsingTest("compiler/testData/psi/examples/FunctionsAndTypes.jet"); + } + + @TestMetadata("Graph.jet") + public void testGraph() throws Exception { + doParsingTest("compiler/testData/psi/examples/Graph.jet"); + } + + @TestMetadata("IPushPop.jet") + public void testIPushPop() throws Exception { + doParsingTest("compiler/testData/psi/examples/IPushPop.jet"); + } + + @TestMetadata("LINQ.jet") + public void testLINQ() throws Exception { + doParsingTest("compiler/testData/psi/examples/LINQ.jet"); + } + + @TestMetadata("PolymorphicClassObjects.jet") + public void testPolymorphicClassObjects() throws Exception { + doParsingTest("compiler/testData/psi/examples/PolymorphicClassObjects.jet"); + } + + @TestMetadata("Queue.jet") + public void testQueue() throws Exception { + doParsingTest("compiler/testData/psi/examples/Queue.jet"); + } + + @TestMetadata("Stack.jet") + public void testStack() throws Exception { + doParsingTest("compiler/testData/psi/examples/Stack.jet"); + } + + @TestMetadata("UnionFind.jet") + public void testUnionFind() throws Exception { + doParsingTest("compiler/testData/psi/examples/UnionFind.jet"); + } + + @TestMetadata("UpdateOperation.jet") + public void testUpdateOperation() throws Exception { + doParsingTest("compiler/testData/psi/examples/UpdateOperation.jet"); + } + + @TestMetadata("With.jet") + public void testWith() throws Exception { + doParsingTest("compiler/testData/psi/examples/With.jet"); + } + + @TestMetadata("compiler/testData/psi/examples/array") + public static class Array extends AbstractJetParsingTest { + public void testAllFilesPresentInArray() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/examples/array"), Pattern.compile("^(.+)\\.jet$"), true); + } + + @TestMetadata("MutableArray.jet") + public void testMutableArray() throws Exception { + doParsingTest("compiler/testData/psi/examples/array/MutableArray.jet"); + } + + } + + @TestMetadata("compiler/testData/psi/examples/collections") + public static class Collections extends AbstractJetParsingTest { + public void testAllFilesPresentInCollections() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/examples/collections"), Pattern.compile("^(.+)\\.jet$"), true); + } + + @TestMetadata("ArrayList.jet") + public void testArrayList() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/ArrayList.jet"); + } + + @TestMetadata("HashMap.jet") + public void testHashMap() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/HashMap.jet"); + } + + @TestMetadata("IIterable.jet") + public void testIIterable() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/IIterable.jet"); + } + + @TestMetadata("IIterator.jet") + public void testIIterator() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/IIterator.jet"); + } + + @TestMetadata("IList.jet") + public void testIList() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/IList.jet"); + } + + @TestMetadata("IMutableIterable.jet") + public void testIMutableIterable() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/IMutableIterable.jet"); + } + + @TestMetadata("IMutableIterator.jet") + public void testIMutableIterator() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/IMutableIterator.jet"); + } + + @TestMetadata("IMutableList.jet") + public void testIMutableList() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/IMutableList.jet"); + } + + @TestMetadata("IMutableSet.jet") + public void testIMutableSet() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/IMutableSet.jet"); + } + + @TestMetadata("ISet.jet") + public void testISet() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/ISet.jet"); + } + + @TestMetadata("ISized.jet") + public void testISized() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/ISized.jet"); + } + + @TestMetadata("LinkedList.jet") + public void testLinkedList() throws Exception { + doParsingTest("compiler/testData/psi/examples/collections/LinkedList.jet"); + } + + } + + @TestMetadata("compiler/testData/psi/examples/io") + public static class Io extends AbstractJetParsingTest { + public void testAllFilesPresentInIo() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/examples/io"), Pattern.compile("^(.+)\\.jet$"), true); + } + + @TestMetadata("IOSamples.jet") + public void testIOSamples() throws Exception { + doParsingTest("compiler/testData/psi/examples/io/IOSamples.jet"); + } + + } + + @TestMetadata("compiler/testData/psi/examples/map") + public static class Map extends AbstractJetParsingTest { + public void testAllFilesPresentInMap() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/examples/map"), Pattern.compile("^(.+)\\.jet$"), true); + } + + @TestMetadata("IMap.jet") + public void testIMap() throws Exception { + doParsingTest("compiler/testData/psi/examples/map/IMap.jet"); + } + + } + + @TestMetadata("compiler/testData/psi/examples/priorityqueues") + public static class Priorityqueues extends AbstractJetParsingTest { + public void testAllFilesPresentInPriorityqueues() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/examples/priorityqueues"), Pattern.compile("^(.+)\\.jet$"), true); + } + + @TestMetadata("BinaryHeap.jet") + public void testBinaryHeap() throws Exception { + doParsingTest("compiler/testData/psi/examples/priorityqueues/BinaryHeap.jet"); + } + + @TestMetadata("IPriorityQueue.jet") + public void testIPriorityQueue() throws Exception { + doParsingTest("compiler/testData/psi/examples/priorityqueues/IPriorityQueue.jet"); + } + + @TestMetadata("PriorityQueueAsPushPop.jet") + public void testPriorityQueueAsPushPop() throws Exception { + doParsingTest("compiler/testData/psi/examples/priorityqueues/PriorityQueueAsPushPop.jet"); + } + + } + + @TestMetadata("compiler/testData/psi/examples/util") + public static class Util extends AbstractJetParsingTest { + public void testAllFilesPresentInUtil() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/examples/util"), Pattern.compile("^(.+)\\.jet$"), true); + } + + @TestMetadata("Comparison.jet") + public void testComparison() throws Exception { + doParsingTest("compiler/testData/psi/examples/util/Comparison.jet"); + } + + @TestMetadata("IComparable.jet") + public void testIComparable() throws Exception { + doParsingTest("compiler/testData/psi/examples/util/IComparable.jet"); + } + + } + + public static Test innerSuite() { + TestSuite suite = new TestSuite("Examples"); + suite.addTestSuite(Examples.class); + suite.addTestSuite(Array.class); + suite.addTestSuite(Collections.class); + suite.addTestSuite(Io.class); + suite.addTestSuite(Map.class); + suite.addTestSuite(Priorityqueues.class); + suite.addTestSuite(Util.class); + return suite; + } + } + + @TestMetadata("compiler/testData/psi/functionReceivers") + public static class FunctionReceivers extends AbstractJetParsingTest { + public void testAllFilesPresentInFunctionReceivers() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/functionReceivers"), Pattern.compile("^(.+)\\.jet$"), true); + } + + @TestMetadata("FunctionTypesWithFunctionReceivers.jet") + public void testFunctionTypesWithFunctionReceivers() throws Exception { + doParsingTest("compiler/testData/psi/functionReceivers/FunctionTypesWithFunctionReceivers.jet"); + } + + @TestMetadata("FunctionsWithFunctionReceivers.jet") + public void testFunctionsWithFunctionReceivers() throws Exception { + doParsingTest("compiler/testData/psi/functionReceivers/FunctionsWithFunctionReceivers.jet"); + } + + @TestMetadata("PropertiesWithFunctionReceivers.jet") + public void testPropertiesWithFunctionReceivers() throws Exception { + doParsingTest("compiler/testData/psi/functionReceivers/PropertiesWithFunctionReceivers.jet"); + } + + } + + @TestMetadata("compiler/testData/psi/greatSyntacticShift") + public static class GreatSyntacticShift extends AbstractJetParsingTest { + public void testAllFilesPresentInGreatSyntacticShift() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/greatSyntacticShift"), Pattern.compile("^(.+)\\.jet$"), true); + } + + @TestMetadata("functionLiterals.jet") + public void testFunctionLiterals() throws Exception { + doParsingTest("compiler/testData/psi/greatSyntacticShift/functionLiterals.jet"); + } + + @TestMetadata("functionTypes.jet") + public void testFunctionTypes() throws Exception { + doParsingTest("compiler/testData/psi/greatSyntacticShift/functionTypes.jet"); + } + + @TestMetadata("FunctionTypesAsArguments.jet") + public void testFunctionTypesAsArguments() throws Exception { + doParsingTest("compiler/testData/psi/greatSyntacticShift/FunctionTypesAsArguments.jet"); + } + + } + + @TestMetadata("compiler/testData/psi/kdoc") + public static class Kdoc extends AbstractJetParsingTest { + public void testAllFilesPresentInKdoc() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/kdoc"), Pattern.compile("^(.+)\\.jet$"), true); + } + + @TestMetadata("AtTags.jet") + public void testAtTags() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/AtTags.jet"); + } + + @TestMetadata("DocCommentAtBeginningOfFile1.jet") + public void testDocCommentAtBeginningOfFile1() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/DocCommentAtBeginningOfFile1.jet"); + } + + @TestMetadata("DocCommentAtBeginningOfFile2.jet") + public void testDocCommentAtBeginningOfFile2() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/DocCommentAtBeginningOfFile2.jet"); + } + + @TestMetadata("DocCommentAtBeginningOfFile3.jet") + public void testDocCommentAtBeginningOfFile3() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/DocCommentAtBeginningOfFile3.jet"); + } + + @TestMetadata("DocCommentAtBeginningOfFile4.jet") + public void testDocCommentAtBeginningOfFile4() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/DocCommentAtBeginningOfFile4.jet"); + } + + @TestMetadata("Markdown.jet") + public void testMarkdown() throws Exception { + doParsingTest("compiler/testData/psi/kdoc/Markdown.jet"); + } + + } + + @TestMetadata("compiler/testData/psi/recovery") + public static class Recovery extends AbstractJetParsingTest { + public void testAllFilesPresentInRecovery() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/recovery"), Pattern.compile("^(.+)\\.jet$"), true); + } + + @TestMetadata("ImportRecovery.jet") + public void testImportRecovery() throws Exception { + doParsingTest("compiler/testData/psi/recovery/ImportRecovery.jet"); + } + + @TestMetadata("kt2172.jet") + public void testKt2172() throws Exception { + doParsingTest("compiler/testData/psi/recovery/kt2172.jet"); + } + + @TestMetadata("PackageRecovery.jet") + public void testPackageRecovery() throws Exception { + doParsingTest("compiler/testData/psi/recovery/PackageRecovery.jet"); + } + + @TestMetadata("ValueParameterNoTypeRecovery.jet") + public void testValueParameterNoTypeRecovery() throws Exception { + doParsingTest("compiler/testData/psi/recovery/ValueParameterNoTypeRecovery.jet"); + } + + } + + public static Test suite() { + TestSuite suite = new TestSuite("JetParsingTestGenerated"); + suite.addTestSuite(JetParsingTestGenerated.class); + suite.addTest(Examples.innerSuite()); + suite.addTestSuite(FunctionReceivers.class); + suite.addTestSuite(GreatSyntacticShift.class); + suite.addTestSuite(Kdoc.class); + suite.addTestSuite(Recovery.class); + return suite; + } +} diff --git a/generators/org/jetbrains/jet/generators/tests/GenerateTests.java b/generators/org/jetbrains/jet/generators/tests/GenerateTests.java index 6f9d0baece7..a5595cff0b4 100644 --- a/generators/org/jetbrains/jet/generators/tests/GenerateTests.java +++ b/generators/org/jetbrains/jet/generators/tests/GenerateTests.java @@ -40,6 +40,7 @@ import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveDescriptorRenderer import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveNamespaceComparingTest; import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveTest; import org.jetbrains.jet.modules.xml.AbstractModuleXmlParserTest; +import org.jetbrains.jet.parsing.AbstractJetParsingTest; import org.jetbrains.jet.plugin.codeInsight.moveUpDown.AbstractCodeMoverTest; import org.jetbrains.jet.plugin.codeInsight.surroundWith.AbstractSurroundWithTest; import org.jetbrains.jet.plugin.codeInsight.unwrap.AbstractUnwrapRemoveTest; @@ -99,6 +100,13 @@ public class GenerateTests { testModel("compiler/testData/resolve", true, "resolve", "doTest") ); + generateTest( + "compiler/tests/", + "JetParsingTestGenerated", + AbstractJetParsingTest.class, + testModel("compiler/testData/psi", true, "jet", "doParsingTest") + ); + GenerateRangesCodegenTestData.main(args); generateTest(