Support psi tests for standard stream api

This commit is contained in:
Vitaliy.Bibaev
2017-10-17 19:05:06 +03:00
committed by Yan Zhulanow
parent 310bcc48a5
commit 8d9b021ef2
2 changed files with 38 additions and 0 deletions
@@ -0,0 +1,32 @@
/*
* Copyright 2000-2017 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 com.intellij.debugger.streams.kotlin
import com.intellij.openapi.projectRoots.JavaSdk
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl
import java.io.File
/**
* @author Vitaliy.Bibaev
*/
object JdkManager {
private val MOCK_JDK_DIR_NAME_PREFIX = "mockJDK-"
val JDK18_PATH: String = File("lib/" + MOCK_JDK_DIR_NAME_PREFIX + "1.8").absolutePath
val mockJdk18: Sdk by lazy { (JavaSdk.getInstance() as JavaSdkImpl).createMockJdk("java 1.8", JDK18_PATH, false) }
}
@@ -3,6 +3,8 @@ package com.intellij.debugger.streams.kotlin
import com.intellij.debugger.streams.test.StreamChainBuilderTestCase
import com.intellij.debugger.streams.wrapper.StreamChain
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.pom.java.LanguageLevel
import junit.framework.TestCase
import java.io.File
import java.nio.file.Paths
@@ -21,6 +23,10 @@ abstract class KotlinPsiChainBuilderTestCase(private val relativePath: String) :
override final fun getRelativeTestPath(): String = relativePath
override fun getProjectJDK(): Sdk {
return JdkManager.mockJdk18
}
abstract class Positive(relativePath: String) : KotlinPsiChainBuilderTestCase(relativePath) {
override fun doTest() {
val chains = buildChains()