Parsing tests

This commit is contained in:
Maxim Shafirov
2010-12-13 19:29:30 +03:00
parent 17d9240d14
commit 5a31694d70
7 changed files with 109 additions and 0 deletions
+1
View File
@@ -5,6 +5,7 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
</content>
<orderEntry type="jdk" jdkName="IDEA 90.SNAPSHOT" jdkType="IDEA JDK" />
<orderEntry type="sourceFolder" forTests="false" />
@@ -23,4 +23,9 @@ public class JetFile extends PsiFileBase {
public FileType getFileType() {
return JetFileType.INSTANCE;
}
@Override
public String toString() {
return "JetFile: " + getName();
}
}
+5
View File
@@ -0,0 +1,5 @@
namespace foo
class Runnable<a,a>(a : doo = 0) : foo(d=0), bar by x, bar {
}
+64
View File
@@ -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)('}')
View File
+2
View File
@@ -0,0 +1,2 @@
JetFile: EmptyFile.jet
<empty list>
@@ -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);}
}