[FE] Convert ClassId.java to Kotlin
This commit is contained in:
committed by
Space Team
parent
a3bcac00e4
commit
a43cb721ba
+6
-6
@@ -31,7 +31,7 @@ class KotlinOnlyClasspathSnapshotterTest : ClasspathSnapshotTestCommon() {
|
||||
fun testSimpleClass() {
|
||||
val sourceFile = getSourceFile("testSimpleClass", "com/example/SimpleClass.kt")
|
||||
val actualSnapshot = sourceFile.compileAndSnapshot().toGson()
|
||||
val expectedSnapshot = sourceFile.getExpectedSnapshotFile().readText()
|
||||
val expectedSnapshot = sourceFile.getExpectedSnapshotText()
|
||||
|
||||
assertEquals(expectedSnapshot, actualSnapshot)
|
||||
|
||||
@@ -55,7 +55,7 @@ class KotlinOnlyClasspathSnapshotterTest : ClasspathSnapshotTestCommon() {
|
||||
val sourceFile = getSourceFile("testSimpleClass", "com/example/SimpleClass.kt")
|
||||
val classFile = sourceFile.compileSingle()
|
||||
val actualSnapshot = classFile.snapshot(ClassSnapshotGranularity.CLASS_LEVEL).toGson()
|
||||
val expectedSnapshot = sourceFile.getExpectedSnapshotFile(ClassSnapshotGranularity.CLASS_LEVEL).readText()
|
||||
val expectedSnapshot = sourceFile.getExpectedSnapshotText(ClassSnapshotGranularity.CLASS_LEVEL)
|
||||
|
||||
assertEquals(expectedSnapshot, actualSnapshot)
|
||||
|
||||
@@ -103,7 +103,7 @@ class JavaOnlyClasspathSnapshotterTest : ClasspathSnapshotTestCommon() {
|
||||
fun testSimpleClass() {
|
||||
val sourceFile = getSourceFile("testSimpleClass", "com/example/SimpleClass.java")
|
||||
val actualSnapshot = sourceFile.compileAndSnapshot().toGson()
|
||||
val expectedSnapshot = sourceFile.getExpectedSnapshotFile().readText()
|
||||
val expectedSnapshot = sourceFile.getExpectedSnapshotText()
|
||||
|
||||
assertEquals(expectedSnapshot, actualSnapshot)
|
||||
|
||||
@@ -126,7 +126,7 @@ class JavaOnlyClasspathSnapshotterTest : ClasspathSnapshotTestCommon() {
|
||||
val sourceFile = getSourceFile("testSimpleClass", "com/example/SimpleClass.java")
|
||||
val classFile = sourceFile.compileSingle()
|
||||
val actualSnapshot = classFile.snapshot(ClassSnapshotGranularity.CLASS_LEVEL).toGson()
|
||||
val expectedSnapshot = sourceFile.getExpectedSnapshotFile(ClassSnapshotGranularity.CLASS_LEVEL).readText()
|
||||
val expectedSnapshot = sourceFile.getExpectedSnapshotText(ClassSnapshotGranularity.CLASS_LEVEL)
|
||||
|
||||
assertEquals(expectedSnapshot, actualSnapshot)
|
||||
|
||||
@@ -135,10 +135,10 @@ class JavaOnlyClasspathSnapshotterTest : ClasspathSnapshotTestCommon() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun TestSourceFile.getExpectedSnapshotFile(granularity: ClassSnapshotGranularity? = null): File {
|
||||
private fun TestSourceFile.getExpectedSnapshotText(granularity: ClassSnapshotGranularity? = null): String {
|
||||
val relativePath = sourceFile.unixStyleRelativePath.substringBeforeLast(".") + ".json"
|
||||
val expectedSnapshotDirName = if (granularity == null) "expected-snapshot" else "expected-snapshot-${granularity.name}"
|
||||
return sourceFile.baseDir.resolve("../$expectedSnapshotDirName/$relativePath")
|
||||
return sourceFile.baseDir.resolve("../$expectedSnapshotDirName/$relativePath").readText().trimEnd()
|
||||
}
|
||||
|
||||
private fun String.assertContains(vararg elements: String) {
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@
|
||||
"fqName": "SimpleClass"
|
||||
}
|
||||
},
|
||||
"local": false
|
||||
"isLocal": false
|
||||
},
|
||||
"classAbiHash": -6515999856905133685,
|
||||
"supertypes": [
|
||||
@@ -18,4 +18,4 @@
|
||||
"internalName": "java/lang/Object"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@
|
||||
"fqName": "SimpleClass"
|
||||
}
|
||||
},
|
||||
"local": false
|
||||
"isLocal": false
|
||||
},
|
||||
"classAbiHash": 2881075740228300324,
|
||||
"classMemberLevelSnapshot": {
|
||||
@@ -40,4 +40,4 @@
|
||||
"internalName": "java/lang/Object"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@
|
||||
"fqName": "SimpleClass"
|
||||
}
|
||||
},
|
||||
"local": false
|
||||
"isLocal": false
|
||||
},
|
||||
"classAbiHash": 8283317449409255124,
|
||||
"supertypes": [
|
||||
@@ -18,4 +18,4 @@
|
||||
"internalName": "java/lang/Object"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@
|
||||
"fqName": "SimpleClass"
|
||||
}
|
||||
},
|
||||
"local": false
|
||||
"isLocal": false
|
||||
},
|
||||
"classAbiHash": 8283317449409255124,
|
||||
"classMemberLevelSnapshot": {
|
||||
@@ -25,7 +25,7 @@
|
||||
"fqName": "SimpleClass"
|
||||
}
|
||||
},
|
||||
"local": false
|
||||
"isLocal": false
|
||||
},
|
||||
"classKind": "CLASS",
|
||||
"classHeaderData": [
|
||||
@@ -74,4 +74,4 @@
|
||||
"internalName": "java/lang/Object"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user