[xml] WEB-68929 Tests. Copy element factory helper for AntParsingTest

GitOrigin-RevId: 262cca06f0592067d149cb4370fec5659e736931
This commit is contained in:
Victor Turansky
2025-02-15 21:37:36 +02:00
committed by intellij-monorepo-bot
parent 8640517101
commit 4fdfbbdbbe
2 changed files with 35 additions and 0 deletions

View File

@@ -12,6 +12,8 @@ import com.intellij.openapi.util.SystemInfo;
import com.intellij.psi.xml.StartTagEndTokenProvider;
import com.intellij.testFramework.ParsingTestCase;
import static com.intellij.lang.ant.XmlElementTypeServiceHelper.registerXmlElementTypeServices;
public class AntParsingTest extends ParsingTestCase {
public AntParsingTest() {
@@ -21,6 +23,7 @@ public class AntParsingTest extends ParsingTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
registerXmlElementTypeServices(getApplication(), getTestRootDisposable());
addExplicitExtension(LanguageASTFactory.INSTANCE, XMLLanguage.INSTANCE, new XmlASTFactory());
registerExtensionPoint(new ExtensionPointName<>("com.intellij.xml.startTagEndToken"),
StartTagEndTokenProvider.class);

View File

@@ -0,0 +1,32 @@
package com.intellij.lang.ant
import com.intellij.lang.html.BackendHtmlElementFactory
import com.intellij.lang.html.BasicHtmlElementFactory
import com.intellij.lang.xml.BackendXmlElementFactory
import com.intellij.lang.xml.BasicXmlElementFactory
import com.intellij.mock.MockApplication
import com.intellij.openapi.Disposable
/**
* Copy of [com.intellij.xml.XmlElementTypeServiceHelper]
* Copied to avoid "cyclic module dependency" exception
*/
internal object XmlElementTypeServiceHelper {
@JvmStatic
fun registerXmlElementTypeServices(
application: MockApplication,
testRootDisposable: Disposable,
) {
application.registerService(
BasicXmlElementFactory::class.java,
BackendXmlElementFactory(),
testRootDisposable,
)
application.registerService(
BasicHtmlElementFactory::class.java,
BackendHtmlElementFactory(),
testRootDisposable,
)
}
}