Add FIR_IGNORE directive to test files that must be skipped
This commit is contained in:
committed by
Mikhail Glukhikh
parent
350bd33769
commit
24cce75899
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
abstract class A {
|
||||
abstract class Nested
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
package a.b
|
||||
|
||||
class C<T, out S> {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
import my.println
|
||||
|
||||
enum class Order {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
interface Some
|
||||
|
||||
object O1 : Some
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
// Unit
|
||||
// │ fun ((T) -> Unit).invoke(T): Unit
|
||||
// │ │
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
class NoPrimary {
|
||||
// String
|
||||
// │
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
package test
|
||||
|
||||
interface Some
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
//constructor annotation/Target(vararg annotation/AnnotationTarget)
|
||||
//│ enum class annotation/AnnotationTarget: Enum<annotation/AnnotationTarget>
|
||||
//│ │ enum entry annotation/AnnotationTarget.EXPRESSION
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
// foo.a: Int
|
||||
// │ fun (Int).compareTo(Int): Int
|
||||
// │ │ foo.b: Int
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
class A {
|
||||
fun foo() {}
|
||||
// Int Int
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
// Int
|
||||
// │ distance.x: Int
|
||||
// │ │ fun (Int).plus(Int): Int
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
//WITH_RUNTIME
|
||||
package test
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
annotation class Ann1(val arr: IntArray)
|
||||
|
||||
annotation class Ann2(val arr: DoubleArray)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
data class Some(val first: Int, val second: Double, val third: String)
|
||||
|
||||
fun foo(some: Some) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
fun foo() {
|
||||
// Int
|
||||
// │fun (Int).rangeTo(Int): ranges/IntRange
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
// Nothing?
|
||||
// │ Nothing?
|
||||
// │ │
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
// collections/Collection<Int>
|
||||
// │ Boolean
|
||||
// │ │
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
class WithInit(x: Int) {
|
||||
// Int
|
||||
// │
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
data class Tuple(val x: Int, val y: Int)
|
||||
|
||||
// Int
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
fun withLocals(p: Int): Int {
|
||||
class Local(val pp: Int) {
|
||||
// Int
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
fun simple() {
|
||||
// Int Int
|
||||
// │ │
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
interface A {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
class Some {
|
||||
// Int
|
||||
// │ Int
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
interface IThing
|
||||
|
||||
// Boolean
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
fun test() {
|
||||
// Int Int
|
||||
// │ │
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
fun foo() {
|
||||
// Int Int
|
||||
// │ │
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
fun foo(limit: Int) {
|
||||
// Int Int
|
||||
// │ │
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
data class Vector(val x: Int, val y: Int) {
|
||||
// Vector
|
||||
// │ constructor Vector(Int, Int)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
interface Base {
|
||||
fun printMessage()
|
||||
fun printMessageLine()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
package p
|
||||
|
||||
class A {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
package org.jetbrains.kotlin.test
|
||||
|
||||
// collections/List<Int>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
package org.jetbrains.kotlin.test
|
||||
|
||||
// Int Int
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
package org.jetbrains.kotlin.test
|
||||
|
||||
abstract class Base<T>(var x: T) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
interface Source<out T> {
|
||||
fun nextT(): T
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IGNORE
|
||||
// collections/List<T> collections/List<String>
|
||||
// │ │
|
||||
fun <T> copyWhenGreater(list: List<T>, threshold: T): List<String>
|
||||
|
||||
+13
-1
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveTransformer
|
||||
import org.jetbrains.kotlin.fir.service
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.visualizer.AbstractVisualizer
|
||||
import org.junit.Assert
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractFirVisualizer : AbstractVisualizer() {
|
||||
@@ -55,6 +56,17 @@ abstract class AbstractFirVisualizer : AbstractVisualizer() {
|
||||
val psiRenderResult = renderer.render()
|
||||
|
||||
val expectedPath = file.absolutePath.replace(replacement.first, replacement.second)
|
||||
KotlinTestUtils.assertEqualsToFile(File(expectedPath), psiRenderResult)
|
||||
val expectedText = File(expectedPath).readLines()
|
||||
if (expectedText[0].startsWith("// FIR_IGNORE")) {
|
||||
Assert.assertFalse(
|
||||
"Files are identical, please delete ignore directive",
|
||||
expectedText.filterIndexed { index, _ -> index > 0 }.joinToString("\n") == psiRenderResult
|
||||
)
|
||||
return
|
||||
}
|
||||
KotlinTestUtils.assertEqualsToFile(File(expectedPath), psiRenderResult) {
|
||||
return@assertEqualsToFile it.replace("// FIR_IGNORE\n", "")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -21,6 +21,8 @@ abstract class AbstractPsiVisualizer : AbstractVisualizer() {
|
||||
val psiRenderResult = renderer.render()
|
||||
|
||||
val expectedPath = file.absolutePath.replace(replacement.first, replacement.second)
|
||||
KotlinTestUtils.assertEqualsToFile(File(expectedPath), psiRenderResult)
|
||||
KotlinTestUtils.assertEqualsToFile(File(expectedPath), psiRenderResult) {
|
||||
return@assertEqualsToFile it.replace("// FIR_IGNORE\n", "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user