IDEA-54000 Move java formatting tests to community edition

Moved from 'idea-tests' to 'java-tests' because java formatter belongs to community edition
This commit is contained in:
Denis Zhdanov
2010-04-19 19:27:17 +04:00
parent e42c2fdcab
commit e8777a2477
24 changed files with 296 additions and 0 deletions
@@ -0,0 +1,6 @@
class C {
{
for(String s :collection) {
}
}
}
@@ -0,0 +1,7 @@
class C {
{
for (String s : collection) {
}
}
}
@@ -0,0 +1,7 @@
class Foo {
void foo() {
if (a) {
}
}
}
@@ -0,0 +1,6 @@
class Foo {
void foo() {
if (a)
return;
}
}
@@ -0,0 +1,8 @@
class Foo {
void foo() {
if (a) {
return;
}
}
}
@@ -0,0 +1,60 @@
public class Foo {
public void foo(boolean a, int x,
int y, int z) {
label1:
do {
try {
if (x > 0) {
int someVariable = a ?
x :
y;
}
else if (x < 0) {
int someVariable = (y +
z
);
someVariable = x =
x +
y;
}
else {
label2:
for (int i = 0;
i < 5;
i++)
doSomething(i);
}
switch (a) {
case 0:
doCase0();
break;
default:
doDefault();
}
}
catch (Exception e) {
processException(e.getMessage(),
x + y, z, a);
}
finally {
processFinally();
}
}
while (true);
if (2 < 3) return;
if (3 < 4)
return;
do x++ while (x < 10000);
while (x < 50000) x++;
for (int i = 0; i < 5; i++) System.out.println(i);
}
private class InnerClass implements I1,
I2 {
public void bar() throws E1,
E2 {
}
}
}
@@ -0,0 +1,62 @@
public class Foo {
public void foo(boolean a, int x,
int y, int z) {
label1:
do {
try {
if (x > 0) {
int someVariable = a ?
x :
y;
}
else
if (x < 0) {
int someVariable = (y +
z
);
someVariable = x =
x +
y;
}
else {
label2:
for (int i = 0;
i < 5;
i++) {
doSomething(i);
}
}
switch (a) {
case 0:
doCase0();
break;
default:
doDefault();
}
}
catch (Exception e) {
processException(e.getMessage(),
x + y, z, a);
}
finally {
processFinally();
}
}
while (true);
if (2 < 3) return;
if (3 < 4)
return;
do x++ while (x < 10000);
while (x < 50000) x++;
for (int i = 0; i < 5; i++) System.out.println(i);
}
private class InnerClass implements I1,
I2 {
public void bar() throws E1,
E2 {
}
}
}
@@ -0,0 +1,8 @@
class Foo {
void foo() {
if (a)
{
}
}
}
@@ -0,0 +1,10 @@
class Foo{
public void foo(){
bar_call(new Runnable(){
void run(){
bar();
bar();
}
});
}
}
@@ -0,0 +1,11 @@
class Foo {
public void foo() {
bar_call(new Runnable() {
void run() {
bar();
bar();
}
});
}
}
@@ -0,0 +1,10 @@
public class Test {
void anotherMethod(String s);
String field;
/**
* @param anObject
*/
void method(Test anObject, String field1) {
anObject.anotherMethod(field1);
}
}
@@ -0,0 +1,13 @@
public class Test {
void anotherMethod(String s);
String field;
/**
* @param anObject
*/
void method(Test anObject, String field1) {
anObject.anotherMethod(field1);
}
}
@@ -0,0 +1,6 @@
class X {
void Y() {
z: for (int i = 0; i < 24; i++) {}
}
}
@@ -0,0 +1,8 @@
class X {
void Y() {
z:
for (int i = 0; i < 24; i++) {
}
}
}
@@ -0,0 +1,4 @@
@XmlType(name = "submissionData",
propOrder = {"submissionId", "submitterId", "contestId", "submittedDate", "submissionContent", "passedScreening", "placement", "paidFor", "price", "markedForPurchase", "removed"})
public class SubmissionData {
}
@@ -0,0 +1,5 @@
@XmlType(name = "submissionData",
propOrder = {"submissionId", "submitterId", "contestId", "submittedDate", "submissionContent",
"passedScreening", "placement", "paidFor", "price", "markedForPurchase", "removed"})
public class SubmissionData {
}
@@ -0,0 +1,6 @@
class Foo{
void foo(){
ClassBar bar =
createBar();
}
}
@@ -0,0 +1,7 @@
class Foo {
void foo() {
ClassBar bar =
createBar();
}
}
@@ -0,0 +1,7 @@
public class C {
C ourC =
new C(
new C()
);
}
@@ -0,0 +1,7 @@
public class C {
C ourC =
new C(
new C()
);
}
@@ -0,0 +1,4 @@
class C {
public static final C1 ourC =
new C2(new C3(),null,new C4(),new C5(),new C6(),new C7());
}
@@ -0,0 +1,10 @@
class C {
public static final C1 ourC =
new C2(new C3(),
null,
new C4(),
new C5(),
new C6(),
new C7());
}
@@ -0,0 +1,12 @@
class Foo{
void foo() {
final IndentInfo indentProperty = Formatter.getInstance().getWhiteSpaceBefore(new PsiBasedFormattingModel(element.getContainingFile(),
settings),
CodeFormatterFacade.createBlock(element.getContainingFile(),
settings),
settings,
indentOptions,
child2.getTextRange(),
false);
}
}
@@ -0,0 +1,12 @@
class Foo {
void foo() {
final IndentInfo indentProperty = Formatter.getInstance().getWhiteSpaceBefore(new PsiBasedFormattingModel(element.getContainingFile(),
settings),
CodeFormatterFacade.createBlock(element.getContainingFile(),
settings),
settings,
indentOptions,
child2.getTextRange(),
false);
}
}