Partial body resolve tests: more informative test output

This commit is contained in:
Valentin Kipyatkov
2014-11-20 13:35:49 +03:00
parent 4503adb7fc
commit cd90ab951f
49 changed files with 495 additions and 100 deletions
@@ -30,6 +30,7 @@ import com.intellij.openapi.util.Key
import java.io.PrintWriter
import java.io.StringWriter
import com.intellij.openapi.application.ApplicationManager
import com.intellij.psi.PsiComment
public fun JetPsiFactory(project: Project?): JetPsiFactory = JetPsiFactory(project!!)
public fun JetPsiFactory(contextElement: JetElement): JetPsiFactory = JetPsiFactory(contextElement.getProject())
@@ -632,6 +633,14 @@ public class JetPsiFactory(private val project: Project) {
return createClass("class foo { class object { } }").getClassObject()!!
}
public fun createComment(text: String): PsiComment {
val file = createFile(text)
val comments = file.getChildren().filterIsInstance<PsiComment>()
val comment = comments.single()
assert(comment.getText() == text)
return comment
}
public fun wrapInABlock(expression: JetExpression): JetBlockExpression {
if (expression is JetBlockExpression) {
return expression as JetBlockExpression