first commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package com.github.cirry.wxreaderjetbrainsplugin
|
||||
|
||||
import com.intellij.ide.highlighter.XmlFileType
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.psi.xml.XmlFile
|
||||
import com.intellij.testFramework.TestDataPath
|
||||
import com.intellij.testFramework.fixtures.BasePlatformTestCase
|
||||
import com.intellij.util.PsiErrorElementUtil
|
||||
import com.github.cirry.wxreaderjetbrainsplugin.services.MyProjectService
|
||||
|
||||
@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)
|
||||
}
|
||||
}
|
||||
|
||||
// fun testRename() {
|
||||
// myFixture.testRename("foo.xml", "foo_after.xml", "a2")
|
||||
// }
|
||||
|
||||
// fun testProjectService() {
|
||||
// val projectService = project.service<MyProjectService>()
|
||||
//
|
||||
// assertNotSame(projectService.getRandomNumber(), projectService.getRandomNumber())
|
||||
// }
|
||||
|
||||
override fun getTestDataPath() = "src/test/testData/rename"
|
||||
}
|
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