Fix path to TestNG library in tests for 191
This commit is contained in:
@@ -28,6 +28,7 @@ import com.intellij.openapi.roots.impl.libraries.LibraryEx
|
||||
import com.intellij.openapi.roots.libraries.Library
|
||||
import com.intellij.openapi.roots.libraries.PersistentLibraryKind
|
||||
import com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.vfs.VfsUtil
|
||||
import org.jetbrains.kotlin.idea.framework.CommonLibraryKind
|
||||
import org.jetbrains.kotlin.idea.framework.JSLibraryKind
|
||||
@@ -189,7 +190,14 @@ object ConfigLibraryUtil {
|
||||
val editor = NewLibraryEditor()
|
||||
editor.name = libraryName
|
||||
for (jarPath in jarPaths) {
|
||||
val jarFile = if (rootPath == null) File(jarPath) else File(rootPath, jarPath)
|
||||
val jarFile = rootPath?.let {
|
||||
File(rootPath, jarPath).takeIf { it.exists() }
|
||||
?: FileUtil.findFilesByMask(jarPath.toPattern(), File(rootPath)).firstOrNull()
|
||||
} ?: File(jarPath)
|
||||
|
||||
require(jarFile.exists()) {
|
||||
"Cannot configure library with given path, file doesn't exists $jarPath"
|
||||
}
|
||||
editor.addRoot(VfsUtil.getUrlForLibraryRoot(jarFile), OrderRootType.CLASSES)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateTestSupportActionBase$Data
|
||||
// CONFIGURE_LIBRARY: TestNG@plugins/testng/lib/testng.jar
|
||||
// CONFIGURE_LIBRARY: TestNG@testng(-|[0-9]|\.)*jar
|
||||
import org.testng.annotations.Test
|
||||
|
||||
@Test class A {<caret>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateTestSupportActionBase$Data
|
||||
// CONFIGURE_LIBRARY: TestNG@plugins/testng/lib/testng.jar
|
||||
// CONFIGURE_LIBRARY: TestNG@testng(-|[0-9]|\.)*jar
|
||||
import org.testng.annotations.DataProvider
|
||||
import org.testng.annotations.Test
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateTestSupportActionBase$SetUp
|
||||
// CONFIGURE_LIBRARY: TestNG@plugins/testng/lib/testng.jar
|
||||
// CONFIGURE_LIBRARY: TestNG@testng(-|[0-9]|\.)*jar
|
||||
import org.testng.annotations.Test
|
||||
|
||||
@Test class A {<caret>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateTestSupportActionBase$SetUp
|
||||
// CONFIGURE_LIBRARY: TestNG@plugins/testng/lib/testng.jar
|
||||
// CONFIGURE_LIBRARY: TestNG@testng(-|[0-9]|\.)*jar
|
||||
import org.testng.annotations.BeforeMethod
|
||||
import org.testng.annotations.Test
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateTestSupportActionBase$SetUp
|
||||
// NOT_APPLICABLE
|
||||
// CONFIGURE_LIBRARY: TestNG@plugins/testng/lib/testng.jar
|
||||
// CONFIGURE_LIBRARY: TestNG@testng(-|[0-9]|\.)*jar
|
||||
import org.testng.annotations.BeforeMethod
|
||||
import org.testng.annotations.Test
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateTestSupportActionBase$SetUp
|
||||
// CONFIGURE_LIBRARY: TestNG@plugins/testng/lib/testng.jar
|
||||
// CONFIGURE_LIBRARY: TestNG@testng(-|[0-9]|\.)*jar
|
||||
import org.testng.annotations.Test
|
||||
|
||||
open class A {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateTestSupportActionBase$SetUp
|
||||
// CONFIGURE_LIBRARY: TestNG@plugins/testng/lib/testng.jar
|
||||
// CONFIGURE_LIBRARY: TestNG@testng(-|[0-9]|\.)*jar
|
||||
import org.testng.annotations.BeforeMethod
|
||||
import org.testng.annotations.Test
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateTestSupportActionBase$TearDown
|
||||
// CONFIGURE_LIBRARY: TestNG@plugins/testng/lib/testng.jar
|
||||
// CONFIGURE_LIBRARY: TestNG@testng(-|[0-9]|\.)*jar
|
||||
import org.testng.annotations.Test
|
||||
|
||||
@Test class A {<caret>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateTestSupportActionBase$TearDown
|
||||
// CONFIGURE_LIBRARY: TestNG@plugins/testng/lib/testng.jar
|
||||
// CONFIGURE_LIBRARY: TestNG@testng(-|[0-9]|\.)*jar
|
||||
import org.testng.annotations.AfterMethod
|
||||
import org.testng.annotations.Test
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateTestSupportActionBase$TearDown
|
||||
// NOT_APPLICABLE
|
||||
// CONFIGURE_LIBRARY: TestNG@plugins/testng/lib/testng.jar
|
||||
// CONFIGURE_LIBRARY: TestNG@testng(-|[0-9]|\.)*jar
|
||||
import org.testng.annotations.AfterMethod
|
||||
import org.testng.annotations.Test
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateTestSupportActionBase$Test
|
||||
// CONFIGURE_LIBRARY: TestNG@plugins/testng/lib/testng.jar
|
||||
// CONFIGURE_LIBRARY: TestNG@testng(-|[0-9]|\.)*jar
|
||||
import org.testng.annotations.Test
|
||||
|
||||
@Test class A {<caret>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateTestSupportActionBase$Test
|
||||
// CONFIGURE_LIBRARY: TestNG@plugins/testng/lib/testng.jar
|
||||
// CONFIGURE_LIBRARY: TestNG@testng(-|[0-9]|\.)*jar
|
||||
import org.testng.annotations.Test
|
||||
|
||||
@Test class A {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// CONFIGURE_LIBRARY: TestNG@plugins/testng/lib/testng.jar
|
||||
// CONFIGURE_LIBRARY: TestNG@testng(-|[0-9]|\.)*jar
|
||||
package testing
|
||||
|
||||
import org.testng.annotations.Test
|
||||
|
||||
Reference in New Issue
Block a user