@@ -71,7 +71,12 @@ class GtsFileTest : BasePlatformTestCase() {
7171
7272 @Test
7373 fun testGtsImportUsed () {
74+ val otherGts = """
75+ export const OtherComponent = 2;
76+ export const other = 2;
77+ """ .trimIndent()
7478 val gts = """
79+ import { OtherComponent, other } from './other-component';
7580 import x from "a";
7681 import { y, quux } from "a";
7782 import qux from "a";
@@ -85,24 +90,28 @@ class GtsFileTest : BasePlatformTestCase() {
8590 export const Grault = {};
8691
8792 export default <template>
93+ <OtherComponent />
8894 <Foo />
8995 <Baz />
9096 <Grault />
9197 {{x}}
9298 {{y}}
9399 {{bar}}
94100 {{grault}}
101+ {{other}}
95102 </template>
96103 """ .trimIndent()
97- myFixture.configureByText(GtsFileType .INSTANCE , gts)
104+ myFixture.addFileToProject(" other-component.ts" , otherGts)
105+ myFixture.addFileToProject(" main.gts" , gts)
106+ myFixture.configureByFile(" main.gts" )
98107 myFixture.enableInspections(ES6UnusedImportsInspection (), JSUnusedLocalSymbolsInspection (), JSUnusedGlobalSymbolsInspection ())
99108 CodeInsightTestFixtureImpl .ensureIndexesUpToDate(project)
100109 val highlighting = myFixture.doHighlighting()
101110 System .out .println (highlighting)
102111 val unusedConstants = highlighting.filter { it.description?.startsWith(" Unused constant" ) == true }
103112 TestCase .assertEquals(unusedConstants.toString(), 0 , unusedConstants.size)
104113 val highlightInfos: List <HighlightInfo > = highlighting.filter { it.inspectionToolId == " ES6UnusedImports" }
105- TestCase .assertEquals(highlightInfos.size, 2 )
114+ TestCase .assertEquals(2 , highlightInfos.size)
106115 TestCase .assertTrue(highlightInfos.first().description.contains(" quux" ))
107116 TestCase .assertTrue(highlightInfos.last().description.contains(" qux" ))
108117 }
0 commit comments