first commit

This commit is contained in:
2023-12-29 00:20:04 +08:00
commit 231a337373
30 changed files with 947 additions and 0 deletions

View File

@@ -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"
}

View File

@@ -0,0 +1,3 @@
<root>
<a<caret>1>Foo</a1>
</root>

View File

@@ -0,0 +1,3 @@
<root>
<a2>Foo</a2>
</root>