mirror of
https://github.com/JetBrains/intellij-platform-plugin-template.git
synced 2026-03-02 03:39:24 +00:00
tests
This commit is contained in:
committed by
Jakub Chrzanowski
parent
9ed85a5ab3
commit
b1f751c5f7
@@ -0,0 +1,31 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
3
src/test/testData/rename/foo.xml
Normal file
3
src/test/testData/rename/foo.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<root>
|
||||
<a<caret>1>Foo</a1>
|
||||
</root>
|
||||
3
src/test/testData/rename/foo_after.xml
Normal file
3
src/test/testData/rename/foo_after.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<root>
|
||||
<a2>Foo</a2>
|
||||
</root>
|
||||
Reference in New Issue
Block a user