You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
977 B
32 lines
977 B
package org.jetbrains.plugins.template
|
|
|
|
import com.intellij.ide.highlighter.XmlFileType
|
|
import com.intellij.psi.xml.XmlFile
|
|
import com.intellij.testFramework.TestDataPath
|
|
import com.intellij.testFramework.fixtures.BasePlatformTestCase
|
|
import com.intellij.util.PsiErrorElementUtil
|
|
|
|
@TestDataPath("\$CONTENT_ROOT/src/test/testData")
|
|
class MyPluginTest : BasePlatformTestCase() {
|
|
|
|
fun testXMLFile() {
|
|
val psiFile = myFixture.configureByText(XmlFileType.INSTANCE, "<foo>bar</foo>")
|
|
val xmlFile = assertInstanceOf(psiFile, XmlFile::class.java)
|
|
|
|
assertFalse(PsiErrorElementUtil.hasErrors(project, xmlFile.virtualFile))
|
|
|
|
assertNotNull(xmlFile.rootTag)
|
|
|
|
xmlFile.rootTag?.let {
|
|
assertEquals("foo", it.name)
|
|
assertEquals("bar", it.value.text)
|
|
}
|
|
}
|
|
|
|
override fun getTestDataPath() = "src/test/testData/rename"
|
|
|
|
fun testRename() {
|
|
myFixture.testRename("foo.xml", "foo_after.xml", "a2")
|
|
}
|
|
}
|