New J2K: add plain text copy-paste conversion test for new J2K

This commit is contained in:
Ilya Kirillov
2019-07-09 16:09:57 +03:00
parent 041677ab1b
commit f0dd21790a
60 changed files with 526 additions and 5 deletions
@@ -0,0 +1,7 @@
import java.util.ArrayList
fun foo() {
bar(ArrayList<String>())
}
+3
View File
@@ -0,0 +1,3 @@
fun foo() {
bar(<caret>)
}
+1
View File
@@ -0,0 +1 @@
new ArrayList<String>()
@@ -0,0 +1,5 @@
import java.util.ArrayList
fun foo() = ArrayList<String>()
@@ -0,0 +1 @@
fun foo() = <caret>
+1
View File
@@ -0,0 +1 @@
new ArrayList<String>()
@@ -0,0 +1,10 @@
package com.example
import java.util.UUID
class ExampleClass {
override fun toString(): String {
return UUID.randomUUID().toString()
}
}
@@ -0,0 +1,8 @@
package com.example
import java.util.UUID
class ExampleClass {
<caret>
}
+4
View File
@@ -0,0 +1,4 @@
@Override
public String toString() {
return UUID.randomUUID().toString();
}
@@ -0,0 +1,34 @@
package test;
public class ToBeImportedJava {
public static final String TO_BE_IMPORTED_CONST = "!!!";
public static void staticMethod() {
}
}
public interface IAmbiguousJava {
}
public interface AmbiguousJava {
}
public interface IAmbiguous {
}
public interface Ambiguous {
}
public class Z {
public interface IAmbiguousJava {
}
public interface AmbiguousJava {
}
}
@@ -0,0 +1,32 @@
package test
class ToBeImportedKotlin {
}
interface IAmbiguous {
}
interface Ambiguous {
}
interface IAmbiguousKotlin {
}
interface AmbiguousKotlin {
}
class Z {
interface IAmbiguousKotlin {
}
interface AmbiguousKotlin {
}
}
@@ -0,0 +1,32 @@
import test.ToBeImportedJava
import test.ToBeImportedJava.TO_BE_IMPORTED_CONST
import test.ToBeImportedJava.staticMethod
import test.ToBeImportedKotlin
import java.util.ArrayList
import java.util.HashMap
class Target {
var listOfPlatformType: List<String> = ArrayList()
var unresolved: UnresolvedInterface<UnresolvedGeneric?>? = UnresolvedImplementation() // Should not add import
var hashMapOfNotImported: Map<ToBeImportedJava, ToBeImportedKotlin> = HashMap()
internal fun acceptKotlinClass(tbi: ToBeImportedKotlin?) {}
internal fun acceptJavaClass(tbi: ToBeImportedJava?) {}
var ambiguousKotlin: IAmbiguousKotlin? = AmbiguousKotlin() // Should not add import in case of 2 declarations in Kotlin
var ambiguous: IAmbiguous? = Ambiguous() // Should not add import in case of ambiguous declarations in Kotlin and in Java
var ambiguousJava: IAmbiguousJava? = AmbiguousJava() // Should not add import in case of 2 declarations in Java
internal fun workWithStatics() {
val a = TO_BE_IMPORTED_CONST
staticMethod()
}
}
+3
View File
@@ -0,0 +1,3 @@
class Target {
<caret>
}
+22
View File
@@ -0,0 +1,22 @@
public List<String> listOfPlatformType = new ArrayList<String>();
UnresolvedInterface<UnresolvedGeneric> unresolved = new UnresolvedImplementation<>(); // Should not add import
Map<ToBeImportedJava, ToBeImportedKotlin> hashMapOfNotImported = new HashMap<>();
void acceptKotlinClass(ToBeImportedKotlin tbi) {
}
void acceptJavaClass(ToBeImportedJava tbi) {
}
IAmbiguousKotlin ambiguousKotlin = new AmbiguousKotlin(); // Should not add import in case of 2 declarations in Kotlin
IAmbiguous ambiguous = new Ambiguous(); // Should not add import in case of ambiguous declarations in Kotlin and in Java
IAmbiguousJava ambiguousJava = new AmbiguousJava(); // Should not add import in case of 2 declarations in Java
void workWithStatics() {
String a = TO_BE_IMPORTED_CONST;
staticMethod();
}
@@ -0,0 +1,4 @@
fun foo() {
bArrayList<String> list = new ArrayList<String>();
// NO_CONVERSION_EXPECTEDar()
}
@@ -0,0 +1,3 @@
fun foo() {
b<caret>ar()
}
@@ -0,0 +1,3 @@
fun foo() {
b<caret>ar()
}
+2
View File
@@ -0,0 +1,2 @@
ArrayList<String> list = new ArrayList<String>();
// NO_CONVERSION_EXPECTED
@@ -0,0 +1,2 @@
// ArrayList<String> list = new ArrayList<String>();
//// NO_CONVERSION_EXPECTED
+1
View File
@@ -0,0 +1 @@
// <caret>
+2
View File
@@ -0,0 +1,2 @@
ArrayList<String> list = new ArrayList<String>();
// NO_CONVERSION_EXPECTED
@@ -0,0 +1,7 @@
fun foo() {
val v = """
ArrayList<String> list = new ArrayList<String>();
// NO_CONVERSION_EXPECTED
"""
}
@@ -0,0 +1,5 @@
fun foo() {
val v = """
<caret>
"""
}
@@ -0,0 +1,2 @@
ArrayList<String> list = new ArrayList<String>();
// NO_CONVERSION_EXPECTED
@@ -0,0 +1,4 @@
fun foo() {
val v = "ArrayList<String> list = new ArrayList<String>();\n" +
"// NO_CONVERSION_EXPECTED\n"
}
@@ -0,0 +1,3 @@
fun foo() {
val v = "<caret>"
}
@@ -0,0 +1,2 @@
ArrayList<String> list = new ArrayList<String>();
// NO_CONVERSION_EXPECTED
+9
View File
@@ -0,0 +1,9 @@
package com.bignerdranch.beatbox.data
/**
* Created by Panel on 18.08.2016.
*/
object BeatBox {
private const val TAG = "BeatBox"
private const val SOUNDS_FOLDER = "sample_sounds"
}
+6
View File
@@ -0,0 +1,6 @@
package com.bignerdranch.beatbox.data
/**
* Created by Panel on 18.08.2016.
*/
<caret>
+4
View File
@@ -0,0 +1,4 @@
public class BeatBox {
private static final String TAG = "BeatBox";
private static final String SOUNDS_FOLDER = "sample_sounds";
}
@@ -0,0 +1,7 @@
import java.util.ArrayList
fun foo() {
bar(/*comment*/ArrayList<String>())
}
+3
View File
@@ -0,0 +1,3 @@
fun foo() {
bar(/*comment*/<caret>)
}
+1
View File
@@ -0,0 +1 @@
new ArrayList<String>()
@@ -0,0 +1,13 @@
import java.util.ArrayList
class A {
internal fun foo() {
val list = ArrayList<String>()
list.add(1)
}
internal fun bar() {}
}
@@ -0,0 +1,3 @@
class A {
<caret>
}
@@ -0,0 +1,3 @@
class A {
<caret>
}
+7
View File
@@ -0,0 +1,7 @@
void foo() {
ArrayList<String> list = new ArrayList<String>();
list.add(1);
}
void bar() {
}
@@ -0,0 +1,11 @@
package to
import java.util.ArrayList
internal fun foo() {
val list = ArrayList<String>()
list.add(1)
}
internal fun bar() {}
@@ -0,0 +1,7 @@
void foo() {
ArrayList<String> list = new ArrayList<String>();
list.add(1);
}
void bar() {
}
@@ -0,0 +1,5 @@
package test;
public class JavaParent {
public void subject() {}
}
+5
View File
@@ -0,0 +1,5 @@
import test.JavaParent
class KotlinChild : JavaParent() {
override fun subject() {}
}
+5
View File
@@ -0,0 +1,5 @@
import test.JavaParent
class KotlinChild : JavaParent() {
<caret>
}
+1
View File
@@ -0,0 +1 @@
@Override public void subject() {}
@@ -0,0 +1,7 @@
package test;
import org.jetbrains.annotations.Nullable;
public interface JavaInterface {
void subject(@Nullable String s)
}
@@ -0,0 +1,5 @@
import test.JavaInterface
class KotlinChild : JavaInterface() {
override fun subject(s: String?) {}
}
@@ -0,0 +1,5 @@
import test.JavaInterface
class KotlinChild : JavaInterface() {
<caret>
}
@@ -0,0 +1 @@
@Override public void subject(String s) {}
@@ -0,0 +1,15 @@
package to
import java.io.File
import java.util.ArrayList
class JavaClass {
internal fun foo(file: File?, target: List<String?>?) {
val list = ArrayList<String?>()
if (file != null) {
list.add(file.name)
}
target?.addAll(list)
}
}
+15
View File
@@ -0,0 +1,15 @@
import java.io.File;
import java.util.ArrayList;
import java.util.List;
class JavaClass {
void foo(File file, List<String> target) {
ArrayList<String> list = new ArrayList<String>();
if (file != null) {
list.add(file.getName());
}
if (target != null) {
target.addAll(list);
}
}
}
@@ -0,0 +1,9 @@
import java.util.ArrayList
fun foo() {
val list = ArrayList<String>()
list.add(1)
}
@@ -0,0 +1,3 @@
fun foo() {
<caret>
}
@@ -0,0 +1,2 @@
ArrayList<String> list = new ArrayList<String>();
list.add(1);
+11
View File
@@ -0,0 +1,11 @@
package to
import java.util.ArrayList
class JavaClass {
internal fun foo() {
val list = ArrayList<String>()
list.add(1)
}
}
+8
View File
@@ -0,0 +1,8 @@
import java.util.ArrayList;
class JavaClass {
void foo() {
ArrayList<String> list = new ArrayList<String>();
list.add(1);
}
}