Add FIR_IGNORE directive to test files that must be skipped

This commit is contained in:
Ivan Cilcic
2019-08-29 22:25:57 +03:00
committed by Mikhail Glukhikh
parent 350bd33769
commit 24cce75899
37 changed files with 51 additions and 2 deletions
@@ -1,3 +1,4 @@
// FIR_IGNORE
abstract class A { abstract class A {
abstract class Nested abstract class Nested
} }
@@ -1,3 +1,4 @@
// FIR_IGNORE
package a.b package a.b
class C<T, out S> { class C<T, out S> {
@@ -1,3 +1,4 @@
// FIR_IGNORE
import my.println import my.println
enum class Order { enum class Order {
@@ -1,3 +1,4 @@
// FIR_IGNORE
interface Some interface Some
object O1 : Some object O1 : Some
@@ -1,3 +1,4 @@
// FIR_IGNORE
// Unit // Unit
// │ fun ((T) -> Unit).invoke(T): Unit // │ fun ((T) -> Unit).invoke(T): Unit
// │ │ // │ │
@@ -1,3 +1,4 @@
// FIR_IGNORE
class NoPrimary { class NoPrimary {
// String // String
// │ // │
@@ -1,3 +1,4 @@
// FIR_IGNORE
package test package test
interface Some interface Some
@@ -1,3 +1,4 @@
// FIR_IGNORE
//constructor annotation/Target(vararg annotation/AnnotationTarget) //constructor annotation/Target(vararg annotation/AnnotationTarget)
//│ enum class annotation/AnnotationTarget: Enum<annotation/AnnotationTarget> //│ enum class annotation/AnnotationTarget: Enum<annotation/AnnotationTarget>
//│ │ enum entry annotation/AnnotationTarget.EXPRESSION //│ │ enum entry annotation/AnnotationTarget.EXPRESSION
@@ -1,3 +1,4 @@
// FIR_IGNORE
// foo.a: Int // foo.a: Int
// │ fun (Int).compareTo(Int): Int // │ fun (Int).compareTo(Int): Int
// │ │ foo.b: Int // │ │ foo.b: Int
@@ -1,3 +1,4 @@
// FIR_IGNORE
class A { class A {
fun foo() {} fun foo() {}
// Int Int // Int Int
@@ -1,3 +1,4 @@
// FIR_IGNORE
// Int // Int
// │ distance.x: Int // │ distance.x: Int
// │ │ fun (Int).plus(Int): Int // │ │ fun (Int).plus(Int): Int
@@ -1,3 +1,4 @@
// FIR_IGNORE
//WITH_RUNTIME //WITH_RUNTIME
package test package test
@@ -1,3 +1,4 @@
// FIR_IGNORE
annotation class Ann1(val arr: IntArray) annotation class Ann1(val arr: IntArray)
annotation class Ann2(val arr: DoubleArray) annotation class Ann2(val arr: DoubleArray)
@@ -1,3 +1,4 @@
// FIR_IGNORE
data class Some(val first: Int, val second: Double, val third: String) data class Some(val first: Int, val second: Double, val third: String)
fun foo(some: Some) { fun foo(some: Some) {
@@ -1,3 +1,4 @@
// FIR_IGNORE
fun foo() { fun foo() {
// Int // Int
// │fun (Int).rangeTo(Int): ranges/IntRange // │fun (Int).rangeTo(Int): ranges/IntRange
@@ -1,3 +1,4 @@
// FIR_IGNORE
// Nothing? // Nothing?
// │ Nothing? // │ Nothing?
// │ │ // │ │
@@ -1,3 +1,4 @@
// FIR_IGNORE
// collections/Collection<Int> // collections/Collection<Int>
// │ Boolean // │ Boolean
// │ │ // │ │
@@ -1,3 +1,4 @@
// FIR_IGNORE
class WithInit(x: Int) { class WithInit(x: Int) {
// Int // Int
// │ // │
@@ -1,3 +1,4 @@
// FIR_IGNORE
data class Tuple(val x: Int, val y: Int) data class Tuple(val x: Int, val y: Int)
// Int // Int
@@ -1,3 +1,4 @@
// FIR_IGNORE
fun withLocals(p: Int): Int { fun withLocals(p: Int): Int {
class Local(val pp: Int) { class Local(val pp: Int) {
// Int // Int
@@ -1,3 +1,4 @@
// FIR_IGNORE
fun simple() { fun simple() {
// Int Int // Int Int
// │ │ // │ │
@@ -1,3 +1,4 @@
// FIR_IGNORE
interface A { interface A {
fun foo() {} fun foo() {}
} }
@@ -1,3 +1,4 @@
// FIR_IGNORE
class Some { class Some {
// Int // Int
// │ Int // │ Int
@@ -1,3 +1,4 @@
// FIR_IGNORE
interface IThing interface IThing
// Boolean // Boolean
@@ -1,3 +1,4 @@
// FIR_IGNORE
fun test() { fun test() {
// Int Int // Int Int
// │ │ // │ │
@@ -1,3 +1,4 @@
// FIR_IGNORE
fun foo() { fun foo() {
// Int Int // Int Int
// │ │ // │ │
@@ -1,3 +1,4 @@
// FIR_IGNORE
fun foo(limit: Int) { fun foo(limit: Int) {
// Int Int // Int Int
// │ │ // │ │
@@ -1,3 +1,4 @@
// FIR_IGNORE
data class Vector(val x: Int, val y: Int) { data class Vector(val x: Int, val y: Int) {
// Vector // Vector
// │ constructor Vector(Int, Int) // │ constructor Vector(Int, Int)
@@ -1,3 +1,4 @@
// FIR_IGNORE
interface Base { interface Base {
fun printMessage() fun printMessage()
fun printMessageLine() fun printMessageLine()
@@ -1,3 +1,4 @@
// FIR_IGNORE
package p package p
class A { class A {
@@ -1,3 +1,4 @@
// FIR_IGNORE
package org.jetbrains.kotlin.test package org.jetbrains.kotlin.test
// collections/List<Int> // collections/List<Int>
@@ -1,3 +1,4 @@
// FIR_IGNORE
package org.jetbrains.kotlin.test package org.jetbrains.kotlin.test
// Int Int // Int Int
@@ -1,3 +1,4 @@
// FIR_IGNORE
package org.jetbrains.kotlin.test package org.jetbrains.kotlin.test
abstract class Base<T>(var x: T) { abstract class Base<T>(var x: T) {
@@ -1,3 +1,4 @@
// FIR_IGNORE
interface Source<out T> { interface Source<out T> {
fun nextT(): T fun nextT(): T
} }
@@ -1,3 +1,4 @@
// FIR_IGNORE
// collections/List<T> collections/List<String> // collections/List<T> collections/List<String>
// │ │ // │ │
fun <T> copyWhenGreater(list: List<T>, threshold: T): List<String> fun <T> copyWhenGreater(list: List<T>, threshold: T): List<String>
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveTransformer
import org.jetbrains.kotlin.fir.service import org.jetbrains.kotlin.fir.service
import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.visualizer.AbstractVisualizer import org.jetbrains.kotlin.visualizer.AbstractVisualizer
import org.junit.Assert
import java.io.File import java.io.File
abstract class AbstractFirVisualizer : AbstractVisualizer() { abstract class AbstractFirVisualizer : AbstractVisualizer() {
@@ -55,6 +56,17 @@ abstract class AbstractFirVisualizer : AbstractVisualizer() {
val psiRenderResult = renderer.render() val psiRenderResult = renderer.render()
val expectedPath = file.absolutePath.replace(replacement.first, replacement.second) 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", "")
}
} }
} }
@@ -21,6 +21,8 @@ abstract class AbstractPsiVisualizer : AbstractVisualizer() {
val psiRenderResult = renderer.render() val psiRenderResult = renderer.render()
val expectedPath = file.absolutePath.replace(replacement.first, replacement.second) 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", "")
}
} }
} }