@@ -5,38 +5,53 @@ import com.intellij.execution.impl.RunManagerImpl
5
5
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl
6
6
import com.intellij.execution.runners.ExecutionEnvironment
7
7
import com.intellij.execution.runners.ProgramRunner
8
- import com.intellij.testFramework.fixtures.BasePlatformTestCase
8
+ import com.intellij.openapi.project.Project
9
+ import com.intellij.testFramework.junit5.TestApplication
10
+ import com.intellij.testFramework.junit5.fixture.projectFixture
9
11
import kotlinx.coroutines.runBlocking
12
+ import org.junit.Assert.assertEquals
13
+ import org.junit.Test
10
14
import java.nio.file.Path
11
15
import kotlin.io.path.Path
12
16
13
- class PowerShellRunConfigurationTests : BasePlatformTestCase () {
17
+ @TestApplication
18
+ class PowerShellRunConfigurationTests {
14
19
20
+ private val projectFixture = projectFixture()
21
+
22
+ private val project: Project
23
+ get() = projectFixture.get()
15
24
private val projectPath: Path
16
25
get() = Path (project.basePath!! )
17
26
private val defaultWorkingDirectory
18
27
get() = projectPath.resolve(" scripts" )
19
28
29
+ @Test
20
30
fun testCustomWorkingDirectoryPath () {
21
31
val customDir = projectPath.resolve(" ttt" )
22
32
assertWorkingDirectory(custom = customDir.toString(), expected = customDir)
23
33
}
24
34
35
+ @Test
25
36
fun testNoCustomWorkingDirectory () {
26
37
assertWorkingDirectory(custom = null , expected = defaultWorkingDirectory)
27
38
}
28
39
40
+ @Test
29
41
fun testEmptyCustomWorkingDirectory () {
30
42
assertWorkingDirectory(custom = " " , expected = defaultWorkingDirectory)
31
43
}
32
44
45
+ @Test
33
46
fun testCustomWorkingDirectoryPathVariable () {
34
47
assertWorkingDirectory(custom = " \$ PROJECT_DIR$/foobar" , expected = projectPath.resolve(" foobar" ))
35
48
}
36
49
50
+ @Test
37
51
fun testInvalidWorkingDir () {
38
52
assertWorkingDirectory(custom = invalidPath, expected = defaultWorkingDirectory)
39
53
}
54
+ @Test
40
55
fun testInvalidScriptPath () {
41
56
assertWorkingDirectory(custom = null , scriptPath = invalidPath, expected = Path (System .getProperty(" user.home" )))
42
57
}
0 commit comments