Scratch: test alignment of inlays

This commit is contained in:
Natalia Selezneva
2018-05-16 12:46:55 +03:00
parent 5da0252651
commit e3b6fad2cd
23 changed files with 38 additions and 38 deletions
@@ -52,7 +52,7 @@ class InlayScratchFileRenderer(val text: String, private val outputType: Scratch
}
override fun toString(): String {
return "${outputType.name}: ${text.trim()}"
return "${text.takeWhile { it.isWhitespace() }}${outputType.name}: ${text.trim()}"
}
companion object {
@@ -52,7 +52,7 @@ class InlayScratchFileRenderer(val text: String, private val outputType: Scratch
}
override fun toString(): String {
return "${outputType.name}: ${text.trim()}"
return "${text.takeWhile { it.isWhitespace() }}${outputType.name}: ${text.trim()}"
}
companion object {
+3 -3
View File
@@ -1,8 +1,8 @@
class GClass<T> { // RESULT: class GClass<T>
class GClass<T> { // RESULT: class GClass<T>
fun foo(t: T): T {
return t
}
}
val g = GClass<Int>() // RESULT: val g: Generics.GClass<Int>
g.foo(1) // RESULT: 1
val g = GClass<Int>() // RESULT: val g: Generics.GClass<Int>
g.foo(1) // RESULT: 1
+1 -1
View File
@@ -5,4 +5,4 @@ class GClass<T> {
}
val g = GClass<Int>()
g.foo(1) // RESULT: 1
g.foo(1) // RESULT: 1
+5 -5
View File
@@ -1,14 +1,14 @@
class MyClass { // RESULT: class MyClass
class MyClass { // RESULT: class MyClass
fun foo() = 1
}
MyClass().foo() // RESULT: 1
MyClass().foo() // RESULT: 1
interface I { // RESULT: interface I
interface I { // RESULT: interface I
fun foo(): Int
}
val i = object: I { // RESULT: val i: Klass.I
val i = object: I { // RESULT: val i: Klass.I
override fun foo(): Int = 1
}
i.foo() // RESULT: 1
i.foo() // RESULT: 1
+2 -2
View File
@@ -2,7 +2,7 @@ class MyClass {
fun foo() = 1
}
MyClass().foo() // RESULT: 1
MyClass().foo() // RESULT: 1
interface I {
fun foo(): Int
@@ -11,4 +11,4 @@ interface I {
val i = object: I {
override fun foo(): Int = 1
}
i.foo() // RESULT: 1
i.foo() // RESULT: 1
@@ -1,3 +1,3 @@
import inlineFun.*
foo { 1 + 3 } // RESULT: 4
foo { 1 + 3 } // RESULT: 4
@@ -1,3 +1,3 @@
import inlineFun.*
foo { 1 + 3 } // RESULT: 4
foo { 1 + 3 } // RESULT: 4
+1 -1
View File
@@ -1,3 +1,3 @@
import myTest.MyJavaClass
MyJavaClass().test() // RESULT: 1
MyJavaClass().test() // RESULT: 1
+1 -1
View File
@@ -1,3 +1,3 @@
import myTest.MyJavaClass
MyJavaClass().test() // RESULT: 1
MyJavaClass().test() // RESULT: 1
+1 -1
View File
@@ -1,2 +1,2 @@
val a = 1 // RESULT: val a: Int
a // RESULT: 1
a // RESULT: 1
+1 -1
View File
@@ -1,2 +1,2 @@
val a = 1
a // RESULT: 1
a // RESULT: 1
+1 -1
View File
@@ -2,4 +2,4 @@ fun foo(): Int { // RESULT: fun foo(): Int
return 1
}
foo() // RESULT: 1
foo() // RESULT: 1
+1 -1
View File
@@ -2,4 +2,4 @@ fun foo(): Int {
return 1
}
foo() // RESULT: 1
foo() // RESULT: 1
+1 -1
View File
@@ -1,4 +1,4 @@
foo.forEach { // ERROR: Unresolved reference: foo; Cannot choose among the following candidates wi...
foo.forEach { // ERROR: Unresolved reference: foo; Cannot choose among the following candidates wi...
1 + 1
}
+1 -1
View File
@@ -1,4 +1,4 @@
foo.forEach { // ERROR: error: unresolved reference: foo
foo.forEach { // ERROR: error: unresolved reference: foo
1 + 1
}
+2 -2
View File
@@ -1,3 +1,3 @@
var a = 1 // RESULT: var a: Int
a++ // RESULT: 1
a // RESULT: 2
a++ // RESULT: 1
a // RESULT: 2
+2 -2
View File
@@ -1,3 +1,3 @@
var a = 1
a++ // RESULT: 1
a // RESULT: 2
a++ // RESULT: 1
a // RESULT: 2
+1 -1
View File
@@ -1,2 +1,2 @@
val a = "a".repeat(100) // RESULT: val a: String
a // RESULT: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
a // RESULT: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
+1 -1
View File
@@ -1,2 +1,2 @@
val a = "a".repeat(100)
a // RESULT: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
a // RESULT: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
+5 -5
View File
@@ -1,19 +1,19 @@
val a = 1 // RESULT: val a: Int
when(a) { // OUTPUT: 1
val a = 1 // RESULT: val a: Int
when(a) { // OUTPUT: 1
1 -> println("1")
else -> println("2")
}
when(a) { // OUTPUT: 1
when(a) { // OUTPUT: 1
1 -> println("1")
}
when(a) { // OUTPUT: 1
when(a) { // OUTPUT: 1
2 -> println("2")
else -> println("1")
}
when(a) { // RESULT: 11
when(a) { // RESULT: 11
1 -> 11
else -> 12
}
+3 -3
View File
@@ -1,14 +1,14 @@
val a = 1
when(a) { // OUTPUT: 1
when(a) { // OUTPUT: 1
1 -> println("1")
else -> println("2")
}
when(a) { // OUTPUT: 1
when(a) { // OUTPUT: 1
1 -> println("1")
}
when(a) { // OUTPUT: 1
when(a) { // OUTPUT: 1
2 -> println("2")
else -> println("1")
}
@@ -132,7 +132,7 @@ abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() {
.filterIsInstance<InlayScratchFileRenderer>()
.forEach {
val str = it.toString()
val offset = doc.getLineEndOffset(line); actualOutput.insert(offset, " // $str")
val offset = doc.getLineEndOffset(line); actualOutput.insert(offset, "${str.takeWhile { it.isWhitespace() }}// ${str.trim()}")
}
}