@@ -15,10 +15,10 @@ class NoMainResolve : SingleFileTestFixture("resolvemain", "NoMain.kt") {
15
15
fun `Should not find any main class info` () {
16
16
val root = testResourcesRoot().resolve(workspaceRoot)
17
17
val fileUri = root.resolve(file).toUri().toString()
18
-
18
+
19
19
val result = languageServer.getProtocolExtensionService().mainClass(TextDocumentIdentifier (fileUri)).get()
20
20
21
- assertNotNull(result )
21
+ @Suppress( " UNCHECKED_CAST " )
22
22
val mainInfo = result as Map <String , String >
23
23
assertNull(mainInfo[" mainClass" ])
24
24
assertEquals(root.toString(), mainInfo[" projectRoot" ])
@@ -31,10 +31,11 @@ class SimpleMainResolve : SingleFileTestFixture("resolvemain", "Simple.kt") {
31
31
fun `Should resolve correct main class of simple file` () {
32
32
val root = testResourcesRoot().resolve(workspaceRoot)
33
33
val fileUri = root.resolve(file).toUri().toString()
34
-
34
+
35
35
val result = languageServer.getProtocolExtensionService().mainClass(TextDocumentIdentifier (fileUri)).get()
36
36
37
37
assertNotNull(result)
38
+ @Suppress(" UNCHECKED_CAST" )
38
39
val mainInfo = result as Map <String , Any >
39
40
assertEquals(" test.SimpleKt" , mainInfo[" mainClass" ])
40
41
assertEquals(Range (Position (2 , 0 ), Position (4 , 1 )), mainInfo[" range" ])
@@ -48,10 +49,11 @@ class JvmNameAnnotationMainResolve : SingleFileTestFixture("resolvemain", "JvmNa
48
49
fun `Should resolve correct main class of file annotated with JvmName` () {
49
50
val root = testResourcesRoot().resolve(workspaceRoot)
50
51
val fileUri = root.resolve(file).toUri().toString()
51
-
52
+
52
53
val result = languageServer.getProtocolExtensionService().mainClass(TextDocumentIdentifier (fileUri)).get()
53
54
54
55
assertNotNull(result)
56
+ @Suppress(" UNCHECKED_CAST" )
55
57
val mainInfo = result as Map <String , Any >
56
58
assertEquals(" com.mypackage.name.Potato" , mainInfo[" mainClass" ])
57
59
assertEquals(Range (Position (5 , 0 ), Position (7 , 1 )), mainInfo[" range" ])
@@ -64,10 +66,11 @@ class CompanionObjectMainResolve : SingleFileTestFixture("resolvemain", "Compani
64
66
fun `Should resolve correct main class of main function inside companion object` () {
65
67
val root = testResourcesRoot().resolve(workspaceRoot)
66
68
val fileUri = root.resolve(file).toUri().toString()
67
-
69
+
68
70
val result = languageServer.getProtocolExtensionService().mainClass(TextDocumentIdentifier (fileUri)).get()
69
71
70
72
assertNotNull(result)
73
+ @Suppress(" UNCHECKED_CAST" )
71
74
val mainInfo = result as Map <String , Any >
72
75
assertEquals(" test.my.companion.SweetPotato" , mainInfo[" mainClass" ])
73
76
assertEquals(Range (Position (8 , 8 ), Position (11 , 9 )), mainInfo[" range" ])
0 commit comments