diff --git a/idea/idea.iml b/idea/idea.iml index 5da9bde713e..f96c303d044 100644 --- a/idea/idea.iml +++ b/idea/idea.iml @@ -5,6 +5,7 @@ + diff --git a/idea/src/org/jetbrains/jet/lang/psi/JetFile.java b/idea/src/org/jetbrains/jet/lang/psi/JetFile.java index dd68d5c31a9..72d149c81ab 100644 --- a/idea/src/org/jetbrains/jet/lang/psi/JetFile.java +++ b/idea/src/org/jetbrains/jet/lang/psi/JetFile.java @@ -23,4 +23,9 @@ public class JetFile extends PsiFileBase { public FileType getFileType() { return JetFileType.INSTANCE; } + + @Override + public String toString() { + return "JetFile: " + getName(); + } } diff --git a/idea/testData/psi/BabySteps.jet b/idea/testData/psi/BabySteps.jet new file mode 100644 index 00000000000..a96fa43ff48 --- /dev/null +++ b/idea/testData/psi/BabySteps.jet @@ -0,0 +1,5 @@ +namespace foo + +class Runnable(a : doo = 0) : foo(d=0), bar by x, bar { + +} diff --git a/idea/testData/psi/BabySteps.txt b/idea/testData/psi/BabySteps.txt new file mode 100644 index 00000000000..ec0c6b7a60b --- /dev/null +++ b/idea/testData/psi/BabySteps.txt @@ -0,0 +1,64 @@ +JetFile: BabySteps.jet + PsiElement(NAMESPACE_KEYWORD)('namespace') + PsiWhiteSpace(' ') + NAMESPACE + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n\n') + CLASS + PsiElement(CLASS_KEYWORD)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Runnable') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(COMMA)(',') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(GT)('>') + PRIMARY_CONSTRUCTOR_PARAMETERS_LIST + PsiElement(LPAR)('(') + PRIMARY_CONSTRUCTOR_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('doo') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + PsiElement(INTEGER_LITERAL)('0') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + DELEGATION_SPECIFIER_LIST + DELEGATION_SPECIFIER + DELEGATOR_SUPER_CALL + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + NAMED_ARGUMENT + PsiElement(IDENTIFIER)('d') + PsiElement(EQ)('=') + PsiElement(INTEGER_LITERAL)('0') + PsiElement(RPAR)(')') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + DELEGATION_SPECIFIER + DELEGATOR_BY + PsiElement(IDENTIFIER)('bar') + PsiWhiteSpace(' ') + PsiElement(by)('by') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + DELEGATION_SPECIFIER + DELEGATOR_SUPER_CLASS + PsiElement(IDENTIFIER)('bar') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/idea/testData/psi/EmptyFile.jet b/idea/testData/psi/EmptyFile.jet new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/testData/psi/EmptyFile.txt b/idea/testData/psi/EmptyFile.txt new file mode 100644 index 00000000000..5ddd4d78d84 --- /dev/null +++ b/idea/testData/psi/EmptyFile.txt @@ -0,0 +1,2 @@ +JetFile: EmptyFile.jet + diff --git a/idea/tests/org/jetbrains/jet/parsing/JetParsingTest.java b/idea/tests/org/jetbrains/jet/parsing/JetParsingTest.java new file mode 100644 index 00000000000..9664e966729 --- /dev/null +++ b/idea/tests/org/jetbrains/jet/parsing/JetParsingTest.java @@ -0,0 +1,32 @@ +/* + * @author max + */ +package org.jetbrains.jet.parsing; + +import com.intellij.openapi.application.PathManager; +import com.intellij.testFramework.ParsingTestCase; +import org.jetbrains.annotations.NonNls; + +import java.io.File; + +public class JetParsingTest extends ParsingTestCase { + static { + System.setProperty("idea.platform.prefix", "Idea"); + } + + public JetParsingTest() { + super("", "jet"); + } + + @Override + protected String getTestDataPath() { + return getHomeDirectory() + "/idea/testData"; + } + + private static String getHomeDirectory() { + return new File(PathManager.getResourceRoot(JetParsingTest.class, "/")).getParentFile().getParentFile().getParent(); + } + + public void testEmptyFile() throws Exception {doTest(true);} + public void testBabySteps() throws Exception {doTest(true);} +}