Temporary remove outdated Uast tests

This commit is contained in:
Yan Zhulanow
2016-10-13 20:28:36 +03:00
committed by Yan Zhulanow
parent d5d491e6b2
commit 4c4d6a4ad4
31 changed files with 0 additions and 2096 deletions
@@ -1,65 +0,0 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.uast
import com.intellij.psi.JavaPsiFacade
import com.intellij.psi.PsiClass
import com.intellij.testFramework.LightCodeInsightTestCase
import com.intellij.testFramework.LightPlatformTestCase
import java.io.File
open class AbstractStructureTest : LightCodeInsightTestCase() {
fun test(name: String) {
// val testDir = testDataPath
// val javaFile = File(testDir, "$name.java")
// val logFile = File(File(testDir, "log"), "$name.txt")
// val renderFile = File(File(testDir, "render"), "$name.txt")
//
// val psiClass = createClass(javaFile.readText())
// val uElement = JavaConverter.convertWithParent(psiClass) ?: error("UFile was not created")
// val uFile = uElement.getContainingFile() ?: error("No containing file")
// try {
// assertEqualsFile(uFile.logString(), logFile)
// } catch (e: NoTestFileException) {
// assertEqualsFile(uFile.renderString(), renderFile)
// throw e
// }
// assertEqualsFile(uFile.renderString(), renderFile)
}
private fun createClass(text: String): PsiClass {
val factory = JavaPsiFacade.getInstance(LightPlatformTestCase.ourProject).elementFactory
val classA = factory.createClassFromText(text, null).innerClasses[0]
return classA
}
private fun assertEqualsFile(text: String, file: File) {
if (!file.exists()) {
file.parentFile.mkdirs()
file.writeText(text)
throw NoTestFileException(file)
} else {
val lineSeparator = System.getProperty("line.separator") ?: "\n"
val expected = file.readLines().map { it.trimEnd() }.joinToString(lineSeparator).trim()
val actual = text.lines().map { it.trimEnd() }.joinToString(lineSeparator).trim()
assertEquals(expected, actual)
}
}
private class NoTestFileException(file: File) : RuntimeException("Test file was generated: $file")
override fun getTestDataPath() = "plugins/uast-java/testData"
}
@@ -1,24 +0,0 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.uast
class StructureTest : AbstractStructureTest() {
fun testSimple() = test("Simple")
fun testControlStructures() = test("ControlStructures")
fun testNestedClasses() = test("NestedClasses")
fun testSpecialExpressions() = test("SpecialExpressions")
fun testLambda() = test("Lambda")
}
-29
View File
@@ -1,29 +0,0 @@
class ControlStructures {
public static void main(String[] args) {
if (args.length == 0) {
return;
}
String mode = args.length == 1 ? "singleArg" : "multiArgs";
for (String arg : args) {
System.out.println(arg);
}
for (int i = 0; i < args.length; ++i) {
System.out.println(i + ": " + args[i]);
}
int i = 0;
while (i < args.length) {
System.out.println("Index " + i);
i++;
}
i = 0;
do {
System.out.println(i);
i += 1;
} while (i < args.length);
}
}
-13
View File
@@ -1,13 +0,0 @@
class Lambda {
void example() {
doJob(arg -> arg + arg, "Mary");
}
void doJob(Job job, String arg) {
System.out.println(job.doJob(arg));
}
}
interface Job {
String doJob(String arg);
}
-13
View File
@@ -1,13 +0,0 @@
class NestedClasses {
public static class Nested {
void func1() {
}
}
public class Inner {
void func2() {
}
}
}
-15
View File
@@ -1,15 +0,0 @@
class Simple {
private String name;
public Simple(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
-54
View File
@@ -1,54 +0,0 @@
class SpecialExpressions {
boolean test() {
assert 5 > 3;
assert 5 > 3 : "Message";
synchronized (this) {
System.out.println("A");
}
int a = 5, b = 7, c;
while (a > 0) {
if (a == 3) {
break;
}
if (a % 5 == 0) {
continue;
}
a--;
}
this.test();
super.hashCode();
String x;
switch (a) {
case 1: {
x = "1";
break;
}
case 3: x = "3";
case 4: x = "4";
default: x = "";
}
if (System.getProperty("abc", "").equals("1")) {
throw new AssertionError("Err");
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
} finally {
a = 3;
}
{
a = 5;
}
return true;
}
}
-103
View File
@@ -1,103 +0,0 @@
UFile (package = )
UClass (_Dummy_, kind = class)
UClass (ControlStructures, kind = class)
UFunction (main, kind = function, paramCount = 1)
UBlockExpression
UIfExpression
UBinaryExpression (===)
UQualifiedExpression
USimpleReferenceExpression (args)
USimpleReferenceExpression (length)
ULiteralExpression (0)
UBlockExpression
UReturnExpression
<no element>
EmptyExpression
UDeclarationsExpression
UVariable (mode, kind = local)
UIfExpression
UBinaryExpression (===)
UQualifiedExpression
USimpleReferenceExpression (args)
USimpleReferenceExpression (length)
ULiteralExpression (1)
ULiteralExpression ("singleArg")
ULiteralExpression ("multiArgs")
UForEachExpression
UVariable (arg, kind = parameter)
<no initializer>
USimpleReferenceExpression (args)
UBlockExpression
UQualifiedExpression
UQualifiedExpression
USimpleReferenceExpression (System)
USimpleReferenceExpression (out)
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
USimpleReferenceExpression (println)
USimpleReferenceExpression (arg)
UForExpression
UDeclarationsExpression
UVariable (i, kind = local)
ULiteralExpression (0)
UBinaryExpression (<)
USimpleReferenceExpression (i)
UQualifiedExpression
USimpleReferenceExpression (args)
USimpleReferenceExpression (length)
UPrefixExpression (++)
USimpleReferenceExpression (i)
UBlockExpression
UQualifiedExpression
UQualifiedExpression
USimpleReferenceExpression (System)
USimpleReferenceExpression (out)
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
USimpleReferenceExpression (println)
UBinaryExpression (+)
UBinaryExpression (+)
USimpleReferenceExpression (i)
ULiteralExpression (": ")
UArrayAccessExpression
USimpleReferenceExpression (args)
USimpleReferenceExpression (i)
UDeclarationsExpression
UVariable (i, kind = local)
ULiteralExpression (0)
UWhileExpression
UBinaryExpression (<)
USimpleReferenceExpression (i)
UQualifiedExpression
USimpleReferenceExpression (args)
USimpleReferenceExpression (length)
UBlockExpression
UQualifiedExpression
UQualifiedExpression
USimpleReferenceExpression (System)
USimpleReferenceExpression (out)
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
USimpleReferenceExpression (println)
UBinaryExpression (+)
ULiteralExpression ("Index ")
USimpleReferenceExpression (i)
UPostfixExpression (++)
USimpleReferenceExpression (i)
UBinaryExpression (=)
USimpleReferenceExpression (i)
ULiteralExpression (0)
UDoWhileExpression
UBinaryExpression (<)
USimpleReferenceExpression (i)
UQualifiedExpression
USimpleReferenceExpression (args)
USimpleReferenceExpression (length)
UBlockExpression
UQualifiedExpression
UQualifiedExpression
USimpleReferenceExpression (System)
USimpleReferenceExpression (out)
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
USimpleReferenceExpression (println)
USimpleReferenceExpression (i)
UBinaryExpression (+=)
USimpleReferenceExpression (i)
ULiteralExpression (1)
-30
View File
@@ -1,30 +0,0 @@
UFile (package = )
UClass (_Dummy_, kind = class)
UClass (Lambda, kind = class)
UFunction (example, kind = function, paramCount = 0)
UBlockExpression
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 2)
USimpleReferenceExpression (doJob)
ULambdaExpression
UVariable (arg, kind = parameter)
<no initializer>
UBinaryExpression (+)
USimpleReferenceExpression (arg)
USimpleReferenceExpression (arg)
ULiteralExpression ("Mary")
UFunction (doJob, kind = function, paramCount = 2)
UBlockExpression
UQualifiedExpression
UQualifiedExpression
USimpleReferenceExpression (System)
USimpleReferenceExpression (out)
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
USimpleReferenceExpression (println)
UQualifiedExpression
USimpleReferenceExpression (job)
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
USimpleReferenceExpression (doJob)
USimpleReferenceExpression (arg)
UClass (Job, kind = interface)
UFunction (doJob, kind = function, paramCount = 1)
<no element>
-10
View File
@@ -1,10 +0,0 @@
UFile (package = )
UClass (_Dummy_, kind = class)
UClass (NestedClasses, kind = class)
UClass (Nested, kind = class)
UFunction (func1, kind = function, paramCount = 0)
UBlockExpression
UClass (Inner, kind = class)
UFunction (func2, kind = function, paramCount = 0)
UBlockExpression
-23
View File
@@ -1,23 +0,0 @@
UFile (package = )
UClass (_Dummy_, kind = class)
UClass (Simple, kind = class)
UVariable (name, kind = member)
EmptyExpression
UFunction (<init>, kind = constructor, paramCount = 1)
UBlockExpression
UBinaryExpression (=)
UQualifiedExpression
UThisExpression
USimpleReferenceExpression (name)
USimpleReferenceExpression (name)
UFunction (getName, kind = function, paramCount = 0)
UBlockExpression
UReturnExpression
USimpleReferenceExpression (name)
UFunction (setName, kind = function, paramCount = 1)
UBlockExpression
UBinaryExpression (=)
UQualifiedExpression
UThisExpression
USimpleReferenceExpression (name)
USimpleReferenceExpression (name)
-126
View File
@@ -1,126 +0,0 @@
UFile (package = )
UClass (_Dummy_, kind = class)
UClass (SpecialExpressions, kind = class)
UFunction (test, kind = function, paramCount = 0)
UBlockExpression
UFunctionCallExpression (UastCallKind(name='assert'), argCount = 1)
<no element>
UBinaryExpression (>)
ULiteralExpression (5)
ULiteralExpression (3)
UFunctionCallExpression (UastCallKind(name='assert'), argCount = 2)
<no element>
UBinaryExpression (>)
ULiteralExpression (5)
ULiteralExpression (3)
ULiteralExpression ("Message")
UBlockExpression
UQualifiedExpression
UQualifiedExpression
USimpleReferenceExpression (System)
USimpleReferenceExpression (out)
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
USimpleReferenceExpression (println)
ULiteralExpression ("A")
UDeclarationsExpression
UVariable (a, kind = local)
ULiteralExpression (5)
UVariable (b, kind = local)
ULiteralExpression (7)
UVariable (c, kind = local)
EmptyExpression
UWhileExpression
UBinaryExpression (>)
USimpleReferenceExpression (a)
ULiteralExpression (0)
UBlockExpression
UIfExpression
UBinaryExpression (===)
USimpleReferenceExpression (a)
ULiteralExpression (3)
UBlockExpression
UBreakExpression (<no label>)
EmptyExpression
UIfExpression
UBinaryExpression (===)
UBinaryExpression (%)
USimpleReferenceExpression (a)
ULiteralExpression (5)
ULiteralExpression (0)
UBlockExpression
UContinueExpression (<no label>)
EmptyExpression
UPostfixExpression (--)
USimpleReferenceExpression (a)
UQualifiedExpression
UThisExpression
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 0)
USimpleReferenceExpression (test)
UQualifiedExpression
USuperExpression
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 0)
USimpleReferenceExpression (hashCode)
UDeclarationsExpression
UVariable (x, kind = local)
EmptyExpression
USwitchExpression
USimpleReferenceExpression (a)
UBlockExpression
USwitchClauseExpression
ULiteralExpression (1)
UBlockExpression
UBinaryExpression (=)
USimpleReferenceExpression (x)
ULiteralExpression ("1")
UBreakExpression (<no label>)
USwitchClauseExpression
ULiteralExpression (3)
UBinaryExpression (=)
USimpleReferenceExpression (x)
ULiteralExpression ("3")
USwitchClauseExpression
ULiteralExpression (4)
UBinaryExpression (=)
USimpleReferenceExpression (x)
ULiteralExpression ("4")
DefaultUSwitchClauseExpression
UBinaryExpression (=)
USimpleReferenceExpression (x)
ULiteralExpression ("")
UIfExpression
UQualifiedExpression
UQualifiedExpression
USimpleReferenceExpression (System)
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 2)
USimpleReferenceExpression (getProperty)
ULiteralExpression ("abc")
ULiteralExpression ("")
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
USimpleReferenceExpression (equals)
ULiteralExpression ("1")
UBlockExpression
UThrowExpression
UFunctionCallExpression (UastCallKind(name='constructor_call'), argCount = 1)
<no element>
ULiteralExpression ("Err")
EmptyExpression
UTryExpression
UBlockExpression
UQualifiedExpression
USimpleReferenceExpression (Thread)
UFunctionCallExpression (UastCallKind(name='function_call'), argCount = 1)
USimpleReferenceExpression (sleep)
ULiteralExpression (1000) UCatchClause
UBlockExpression
UBlockExpression
UBinaryExpression (=)
USimpleReferenceExpression (a)
ULiteralExpression (3)
UBlockExpression
UBinaryExpression (=)
USimpleReferenceExpression (a)
ULiteralExpression (5)
UReturnExpression
ULiteralExpression (true)
-32
View File
@@ -1,32 +0,0 @@
package_local class _Dummy_ {
package_local class ControlStructures {
public static fun main(args: String[]): void {
if (args.length === 0) {
return
}
local var mode: String = (args.length === 1) ? ("singleArg") : ("multiArgs")
for (arg : args) {
System.out.println(arg)
}
for (local var i: int = 0; i < args.length; ++i) {
System.out.println(i + ": " + args[i])
}
local var i: int = 0
while (i < args.length) {
System.out.println("Index " + i)
i++
}
i = 0
do {
System.out.println(i)
i += 1
}
while (i < args.length)
}
}
}
-17
View File
@@ -1,17 +0,0 @@
package_local class _Dummy_ {
package_local class Lambda {
package_local fun example(): void {
doJob({ arg: String ->
arg + arg
}, "Mary")
}
package_local fun doJob(job: Job, arg: String): void {
System.out.println(job.doJob(arg))
}
}
package_local abstract static interface Job {
public abstract fun doJob(arg: String): String
}
}
-13
View File
@@ -1,13 +0,0 @@
package_local class _Dummy_ {
package_local class NestedClasses {
public static class Nested {
package_local fun func1(): void {
}
}
public class Inner {
package_local fun func2(): void {
}
}
}
}
-17
View File
@@ -1,17 +0,0 @@
package_local class _Dummy_ {
package_local class Simple {
private var name: String
public fun <init>(name: String) {
this.name = name
}
public fun getName(): String {
return name
}
public fun setName(name: String): void {
this.name = name
}
}
}
@@ -1,64 +0,0 @@
package_local class _Dummy_ {
package_local class SpecialExpressions {
package_local fun test(): boolean {
<assert>(5 > 3)
<assert>(5 > 3, "Message")
{
System.out.println("A")
}
local var a: int = 5
local var b: int = 7
local var c: int
while (a > 0) {
if (a === 3) {
break
}
if (a % 5 === 0) {
continue
}
a--
}
this.test()
super.hashCode()
local var x: String
switch (a)
{
1 ->
{
x = "1"
break
}
3 ->
x = "3"
4 ->
x = "4"
else ->
x = ""
}
if (System.getProperty("abc", "").equals("1")) {
throw AssertionError("Err")
}
try {
Thread.sleep(1000)
}
catch (e) {
}
finally {
a = 3
}
{
a = 5
}
return true
}
}
}