[prev in list] [next in list] [prev in thread] [next in thread]
List: jedit-cvs
Subject: [ jEdit-commits ] SF.net SVN: jedit:[19512]
From: daleanson () users ! sourceforge ! net
Date: 2011-04-20 17:14:02
Message-ID: E1QCayY-0005OI-AD () sfp-svn-6 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]
Revision: 19512
http://jedit.svn.sourceforge.net/jedit/?rev=19512&view=rev
Author: daleanson
Date: 2011-04-20 17:14:02 +0000 (Wed, 20 Apr 2011)
Log Message:
-----------
updated test for multi-slash single line comment
Modified Paths:
--------------
plugins/Beauty/trunk/test/test/beauty/beautifiers/JavaBeautifierTest.java
Modified: plugins/Beauty/trunk/test/test/beauty/beautifiers/JavaBeautifierTest.java
===================================================================
--- plugins/Beauty/trunk/test/test/beauty/beautifiers/JavaBeautifierTest.java 2011-04-20 \
17:02:02 UTC (rev 19511)
+++ plugins/Beauty/trunk/test/test/beauty/beautifiers/JavaBeautifierTest.java 2011-04-20 \
17:14:02 UTC (rev 19512) @@ -19,7 +19,7 @@
@Before
public void beforeTest() {
- jEdit.getPlugin(BeautyPlugin.class.getName()).getPluginJAR().activatePluginIfNecessary();
+ jEdit.getPlugin( BeautyPlugin.class.getName() \
).getPluginJAR().activatePluginIfNecessary(); }
@Test
@@ -27,26 +27,27 @@
// basic test for package, import, and compilation unit
try {
StringBuilder sb = new StringBuilder();
- sb.append("package test.more.whatever;\n");
- sb.append("\n");
- sb.append("import java.util.*;\n");
- sb.append("\n");
- sb.append("public class Test {\n");
- sb.append("}\n");
+ sb.append( "package test.more.whatever;\n" );
+ sb.append( "\n" );
+ sb.append( "import java.util.*;\n" );
+ sb.append( "\n" );
+ sb.append( "public class Test {\n" );
+ sb.append( "}\n" );
Beautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- String after = beautifier.beautify(sb.toString());
- assertTrue("returned text was null", after != null);
- assertTrue("'compilation unit' test failed.", \
sb.toString().equals(after));
- } catch (Exception e) {
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( sb.toString() );
+ assertTrue( "returned text was null", after != null );
+ assertTrue( "'compilation unit' test failed.", sb.toString().equals( \
after ) ); + }
+ catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
@@ -55,41 +56,42 @@
// test the various if constructs
try {
StringBuilder sb = new StringBuilder();
- sb.append("public class Test {\n");
- sb.append(" public void goodIf() {\n");
- sb.append(" if (condition) {\n");
- sb.append(" statements;\n");
- sb.append(" }\n");
- sb.append("\n");
- sb.append(" if (condition) {\n");
- sb.append(" statements;\n");
- sb.append(" } else {\n");
- sb.append(" statements;\n");
- sb.append(" }\n");
- sb.append("\n");
- sb.append(" if (condition) {\n");
- sb.append(" statements;\n");
- sb.append(" } else if (condition) {\n");
- sb.append(" statements;\n");
- sb.append(" } else {\n");
- sb.append(" statements;\n");
- sb.append(" }\n");
- sb.append(" }\n");
- sb.append("}\n");
+ sb.append( "public class Test {\n" );
+ sb.append( " public void goodIf() {\n" );
+ sb.append( " if (condition) {\n" );
+ sb.append( " statements;\n" );
+ sb.append( " }\n" );
+ sb.append( "\n" );
+ sb.append( " if (condition) {\n" );
+ sb.append( " statements;\n" );
+ sb.append( " } else {\n" );
+ sb.append( " statements;\n" );
+ sb.append( " }\n" );
+ sb.append( "\n" );
+ sb.append( " if (condition) {\n" );
+ sb.append( " statements;\n" );
+ sb.append( " } else if (condition) {\n" );
+ sb.append( " statements;\n" );
+ sb.append( " } else {\n" );
+ sb.append( " statements;\n" );
+ sb.append( " }\n" );
+ sb.append( " }\n" );
+ sb.append( "}\n" );
Beautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- String after = beautifier.beautify(sb.toString());
- assertTrue("returned text was null", after != null);
- assertTrue("'if' test failed:\nexpected:\n" + sb.toString() + "\nbut \
was:\n" + after, sb.toString().equals(after));
- } catch (Exception e) {
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( sb.toString() );
+ assertTrue( "returned text was null", after != null );
+ assertTrue( "'if' test failed:\nexpected:\n" + sb.toString() + "\nbut \
was:\n" + after, sb.toString().equals( after ) ); + }
+ catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
@@ -98,60 +100,61 @@
// test that brackets are inserted in 'if' and 'else'
try {
StringBuilder before = new StringBuilder();
- before.append("public class Test {\n");
- before.append(" public void goodIf() {\n");
- before.append(" if (condition) \n");
- before.append(" statements;\n");
- before.append("\n");
- before.append(" if (condition) \n");
- before.append(" statements;\n");
- before.append(" else \n");
- before.append(" statements;\n");
- before.append("\n");
- before.append(" if (condition) \n");
- before.append(" statements;\n");
- before.append(" else if (condition) \n");
- before.append(" statements;\n");
- before.append(" else\n");
- before.append(" statements;\n");
- before.append(" }\n");
- before.append("}\n");
+ before.append( "public class Test {\n" );
+ before.append( " public void goodIf() {\n" );
+ before.append( " if (condition) \n" );
+ before.append( " statements;\n" );
+ before.append( "\n" );
+ before.append( " if (condition) \n" );
+ before.append( " statements;\n" );
+ before.append( " else \n" );
+ before.append( " statements;\n" );
+ before.append( "\n" );
+ before.append( " if (condition) \n" );
+ before.append( " statements;\n" );
+ before.append( " else if (condition) \n" );
+ before.append( " statements;\n" );
+ before.append( " else\n" );
+ before.append( " statements;\n" );
+ before.append( " }\n" );
+ before.append( "}\n" );
StringBuilder answer = new StringBuilder();
- answer.append("public class Test {\n");
- answer.append(" public void goodIf() {\n");
- answer.append(" if (condition) {\n");
- answer.append(" statements;\n");
- answer.append(" }\n");
- answer.append("\n");
- answer.append(" if (condition) {\n");
- answer.append(" statements;\n");
- answer.append(" } else {\n");
- answer.append(" statements;\n");
- answer.append(" }\n");
- answer.append("\n");
- answer.append(" if (condition) {\n");
- answer.append(" statements;\n");
- answer.append(" } else if (condition) {\n");
- answer.append(" statements;\n");
- answer.append(" } else {\n");
- answer.append(" statements;\n");
- answer.append(" }\n");
- answer.append(" }\n");
- answer.append("}\n");
+ answer.append( "public class Test {\n" );
+ answer.append( " public void goodIf() {\n" );
+ answer.append( " if (condition) {\n" );
+ answer.append( " statements;\n" );
+ answer.append( " }\n" );
+ answer.append( "\n" );
+ answer.append( " if (condition) {\n" );
+ answer.append( " statements;\n" );
+ answer.append( " } else {\n" );
+ answer.append( " statements;\n" );
+ answer.append( " }\n" );
+ answer.append( "\n" );
+ answer.append( " if (condition) {\n" );
+ answer.append( " statements;\n" );
+ answer.append( " } else if (condition) {\n" );
+ answer.append( " statements;\n" );
+ answer.append( " } else {\n" );
+ answer.append( " statements;\n" );
+ answer.append( " }\n" );
+ answer.append( " }\n" );
+ answer.append( "}\n" );
Beautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- String after = beautifier.beautify(before.toString());
- assertTrue("returned text was null", after != null);
- assertTrue("'if' test 2 failed:\nexpected:\n" + answer.toString() + \
"\nbut was:\n" + after, answer.toString().equals(after));
- } catch (Exception e) {
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( before.toString() );
+ assertTrue( "returned text was null", after != null );
+ assertTrue( "'if' test 2 failed:\nexpected:\n" + answer.toString() + \
"\nbut was:\n" + after, answer.toString().equals( after ) ); + }
+ catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
@@ -160,29 +163,30 @@
// test the 'for' constructs
try {
StringBuilder sb = new StringBuilder();
- sb.append("public class Test {\n");
- sb.append(" public void goodFor() {\n");
- sb.append(" for (int i = 0; i < 10; i++) {\n");
- sb.append(" statements;\n");
- sb.append(" }\n");
- sb.append("\n");
- sb.append(" for (int i = 0; i < 10; i++);\n");
- sb.append(" }\n");
- sb.append("}\n");
+ sb.append( "public class Test {\n" );
+ sb.append( " public void goodFor() {\n" );
+ sb.append( " for (int i = 0; i < 10; i++) {\n" );
+ sb.append( " statements;\n" );
+ sb.append( " }\n" );
+ sb.append( "\n" );
+ sb.append( " for (int i = 0; i < 10; i++);\n" );
+ sb.append( " }\n" );
+ sb.append( "}\n" );
Beautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- String after = beautifier.beautify(sb.toString());
- assertTrue("returned text was null", after != null);
- assertTrue("'for' test failed:\nexpected:\n" + sb.toString() + "\nbut \
was:\n" + after, sb.toString().equals(after));
- } catch (Exception e) {
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( sb.toString() );
+ assertTrue( "returned text was null", after != null );
+ assertTrue( "'for' test failed:\nexpected:\n" + sb.toString() + "\nbut \
was:\n" + after, sb.toString().equals( after ) ); + }
+ catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
@@ -191,29 +195,30 @@
// test the 'while' constructs
try {
StringBuilder sb = new StringBuilder();
- sb.append("public class Test {\n");
- sb.append(" public void goodWhile() {\n");
- sb.append(" while (i < 10) {\n");
- sb.append(" statements;\n");
- sb.append(" }\n");
- sb.append("\n");
- sb.append(" while (i < 10);\n");
- sb.append(" }\n");
- sb.append("}\n");
+ sb.append( "public class Test {\n" );
+ sb.append( " public void goodWhile() {\n" );
+ sb.append( " while (i < 10) {\n" );
+ sb.append( " statements;\n" );
+ sb.append( " }\n" );
+ sb.append( "\n" );
+ sb.append( " while (i < 10);\n" );
+ sb.append( " }\n" );
+ sb.append( "}\n" );
Beautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- String after = beautifier.beautify(sb.toString());
- assertTrue("returned text was null", after != null);
- assertTrue("'while' test failed:\nexpected:\n" + sb.toString() + "\nbut \
was:\n" + after, sb.toString().equals(after));
- } catch (Exception e) {
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( sb.toString() );
+ assertTrue( "returned text was null", after != null );
+ assertTrue( "'while' test failed:\nexpected:\n" + sb.toString() + "\nbut \
was:\n" + after, sb.toString().equals( after ) ); + }
+ catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
@@ -222,27 +227,28 @@
// test the 'do/while' constructs
try {
StringBuilder sb = new StringBuilder();
- sb.append("public class Test {\n");
- sb.append(" public void goodDoWhile() {\n");
- sb.append(" do {\n");
- sb.append(" statements;\n");
- sb.append(" } while (i < 10);\n");
- sb.append(" }\n");
- sb.append("}\n");
+ sb.append( "public class Test {\n" );
+ sb.append( " public void goodDoWhile() {\n" );
+ sb.append( " do {\n" );
+ sb.append( " statements;\n" );
+ sb.append( " } while (i < 10);\n" );
+ sb.append( " }\n" );
+ sb.append( "}\n" );
Beautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- String after = beautifier.beautify(sb.toString());
- assertTrue("returned text was null", after != null);
- assertTrue("'do/while' test failed:\nexpected:\n" + sb.toString() + \
"\nbut was:\n" + after, sb.toString().equals(after));
- } catch (Exception e) {
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( sb.toString() );
+ assertTrue( "returned text was null", after != null );
+ assertTrue( "'do/while' test failed:\nexpected:\n" + sb.toString() + \
"\nbut was:\n" + after, sb.toString().equals( after ) ); + }
+ catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
@@ -251,41 +257,42 @@
// test the 'switch' construct
try {
StringBuilder sb = new StringBuilder();
- sb.append("public class Test {\n");
- sb.append(" public void goodSwitch() {\n");
- sb.append(" switch (condition) {\n");
- sb.append(" case ABC:\n");
- sb.append(" statements;\n");
- sb.append(" /* falls through */\n");
- sb.append("\n");
- sb.append(" case DEF:\n");
- sb.append(" statements;\n");
- sb.append(" break;\n");
- sb.append("\n");
- sb.append(" case XYZ:\n");
- sb.append(" statements;\n");
- sb.append(" break;\n");
- sb.append("\n");
- sb.append(" default:\n");
- sb.append(" statements;\n");
- sb.append(" break;\n");
- sb.append(" }\n");
- sb.append(" }\n");
- sb.append("}\n");
+ sb.append( "public class Test {\n" );
+ sb.append( " public void goodSwitch() {\n" );
+ sb.append( " switch (condition) {\n" );
+ sb.append( " case ABC:\n" );
+ sb.append( " statements;\n" );
+ sb.append( " /* falls through */\n" );
+ sb.append( "\n" );
+ sb.append( " case DEF:\n" );
+ sb.append( " statements;\n" );
+ sb.append( " break;\n" );
+ sb.append( "\n" );
+ sb.append( " case XYZ:\n" );
+ sb.append( " statements;\n" );
+ sb.append( " break;\n" );
+ sb.append( "\n" );
+ sb.append( " default:\n" );
+ sb.append( " statements;\n" );
+ sb.append( " break;\n" );
+ sb.append( " }\n" );
+ sb.append( " }\n" );
+ sb.append( "}\n" );
Beautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- String after = beautifier.beautify(sb.toString());
- assertTrue("returned text was null", after != null);
- assertTrue("'switch' test failed:\nexpected:\n" + sb.toString() + "\nbut \
was:\n" + after, sb.toString().equals(after));
- } catch (Exception e) {
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( sb.toString() );
+ assertTrue( "returned text was null", after != null );
+ assertTrue( "'switch' test failed:\nexpected:\n" + sb.toString() + \
"\nbut was:\n" + after, sb.toString().equals( after ) ); + }
+ catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
@Test
@@ -293,85 +300,115 @@
// test the various comment constructs
try {
StringBuilder sb = new StringBuilder();
- sb.append("public class Test {\n");
- sb.append(" /**\n");
- sb.append(" * a javadoc comment\n");
- sb.append(" * @param condition The switch condition\n");
- sb.append(" * @return the condition\n");
- sb.append(" */\n");
- sb.append(" public int goodSwitch(int condition) {\n");
- sb.append(" // a single line comment\n");
- sb.append(" switch (condition) {\n");
- sb.append(" case ABC:\n");
- sb.append(" statements;\n");
- sb.append(" /* falls through, a single line block comment \
*/\n");
- sb.append("\n");
- sb.append(" case DEF:\n");
- sb.append(" statements;\n");
- sb.append(" break;\n");
- sb.append("\n");
- sb.append(" case XYZ:\n");
- sb.append(" statements;\n");
- sb.append(" break;\n");
- sb.append("\n");
- sb.append(" default:\n");
- sb.append(" statements;\n");
- sb.append(" break;\n");
- sb.append(" }\n");
- sb.append(" /*\n");
- sb.append(" a multi-line\n");
- sb.append(" block comment\n");
- sb.append(" another line\n");
- sb.append(" */\n");
- sb.append(" return condition;\n");
- sb.append(" }\n");
- sb.append("}\n");
+ sb.append( "public class Test {\n" );
+ sb.append( " /**\n" );
+ sb.append( " * a javadoc comment\n" );
+ sb.append( " * @param condition The switch condition\n" );
+ sb.append( " * @return the condition\n" );
+ sb.append( " */\n" );
+ sb.append( " public int goodSwitch(int condition) {\n" );
+ sb.append( " // a single line comment\n" );
+ sb.append( " switch (condition) {\n" );
+ sb.append( " case ABC:\n" );
+ sb.append( " statements;\n" );
+ sb.append( " /* falls through, a single line block \
comment */\n" ); + sb.append( "\n" );
+ sb.append( " case DEF:\n" );
+ sb.append( " statements;\n" );
+ sb.append( " break;\n" );
+ sb.append( "\n" );
+ sb.append( " case XYZ:\n" );
+ sb.append( " statements;\n" );
+ sb.append( " break;\n" );
+ sb.append( "\n" );
+ sb.append( " default:\n" );
+ sb.append( " statements;\n" );
+ sb.append( " break;\n" );
+ sb.append( " }\n" );
+ sb.append( " /*\n" );
+ sb.append( " a multi-line\n" );
+ sb.append( " block comment\n" );
+ sb.append( " another line\n" );
+ sb.append( " */\n" );
+ sb.append( " return condition;\n" );
+ sb.append( " }\n" );
+ sb.append( "}\n" );
Beautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- String after = beautifier.beautify(sb.toString());
- assertTrue("returned text was null", after != null);
- assertTrue("'comment' test failed:\nexpected:\n" + sb.toString() + \
"\nbut was:\n" + after, sb.toString().equals(after));
- } catch (Exception e) {
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( sb.toString() );
+ assertTrue( "returned text was null", after != null );
+ assertTrue( "'comment' test failed:\nexpected:\n" + sb.toString() + \
"\nbut was:\n" + after, sb.toString().equals( after ) ); + }
+ catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
+
+ // test to allow single line comments with multiple slashes. It is a \
somewhat + // common practice to use 3 or 4 slashes to indicate a temporary \
removal of + // code or to mark a TODO.
+ try {
+ StringBuilder before = new StringBuilder();
+ before.append( "public class CommentTest {\n" );
+ before.append( " ////a comment\n" );
+ before.append( "}\n" );
+ StringBuilder answer = new StringBuilder();
+ answer.append( "public class CommentTest {\n" );
+ answer.append( " //// a comment\n" );
+ answer.append( "}\n" );
+ Beautifier beautifier = new JavaBeautifier();
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( before.toString() );
+ assertTrue( "returned text was null", after != null );
+ assertTrue( "'comment' test failed:\nexpected:\n" + answer.toString() + \
"\nbut was:\n" + after, answer.toString().equals( after ) ); + }
+ catch ( Exception e ) {
+ e.printStackTrace();
+ }
}
@Test
public void testSingleLineComment() {
try {
StringBuilder before = new StringBuilder();
- before.append("public class Test {\n");
- before.append(" public int goodSwitch(int condition) {\n");
- before.append(" //a single line comment\n");
- before.append(" }\n");
- before.append("}\n");
+ before.append( "public class Test {\n" );
+ before.append( " public int goodSwitch(int condition) {\n" );
+ before.append( " //a single line comment\n" );
+ before.append( " }\n" );
+ before.append( "}\n" );
StringBuilder answer = new StringBuilder();
- answer.append("public class Test {\n");
- answer.append(" public int goodSwitch(int condition) {\n");
- answer.append(" // a single line comment\n");
- answer.append(" }\n");
- answer.append("}\n");
+ answer.append( "public class Test {\n" );
+ answer.append( " public int goodSwitch(int condition) {\n" );
+ answer.append( " // a single line comment\n" );
+ answer.append( " }\n" );
+ answer.append( "}\n" );
Beautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- String after = beautifier.beautify(before.toString());
- assertTrue("returned text was null", after != null);
- assertTrue("'comment' test failed:\nexpected:\n" + answer.toString() + \
"\nbut was:\n" + after, answer.toString().equals(after));
- } catch (Exception e) {
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( before.toString() );
+ assertTrue( "returned text was null", after != null );
+ assertTrue( "'comment' test failed:\nexpected:\n" + answer.toString() + \
"\nbut was:\n" + after, answer.toString().equals( after ) ); + }
+ catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
@@ -379,31 +416,32 @@
public void testSingleLineComment2() {
try {
StringBuilder before = new StringBuilder();
- before.append("public class Test {\n");
- before.append(" public int goodSwitch(int condition) {\n");
- before.append(" // a single line comment\n");
- before.append(" }\n");
- before.append("}\n");
+ before.append( "public class Test {\n" );
+ before.append( " public int goodSwitch(int condition) {\n" );
+ before.append( " // a single line comment\n" );
+ before.append( " }\n" );
+ before.append( "}\n" );
StringBuilder answer = new StringBuilder();
- answer.append("public class Test {\n");
- answer.append(" public int goodSwitch(int condition) {\n");
- answer.append(" // a single line comment\n");
- answer.append(" }\n");
- answer.append("}\n");
+ answer.append( "public class Test {\n" );
+ answer.append( " public int goodSwitch(int condition) {\n" );
+ answer.append( " // a single line comment\n" );
+ answer.append( " }\n" );
+ answer.append( "}\n" );
Beautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- String after = beautifier.beautify(before.toString());
- assertTrue("returned text was null", after != null);
- assertTrue("'comment' test failed:\nexpected:\n" + answer.toString() + \
"\nbut was:\n" + after, answer.toString().equals(after));
- } catch (Exception e) {
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( before.toString() );
+ assertTrue( "returned text was null", after != null );
+ assertTrue( "'comment' test failed:\nexpected:\n" + answer.toString() + \
"\nbut was:\n" + after, answer.toString().equals( after ) ); + }
+ catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
@@ -412,37 +450,38 @@
// test the 'do/while' constructs
try {
StringBuilder sb = new StringBuilder();
- sb.append("public class Test {\n");
- sb.append(" public int tryCatch(int condition) {\n");
- sb.append(" try {\n");
- sb.append(" statements;\n");
- sb.append(" } catch (ExceptionClass e) {\n");
- sb.append(" statements;\n");
- sb.append(" }\n");
- sb.append("\n");
- sb.append(" try {\n");
- sb.append(" statements;\n");
- sb.append(" } catch (ExceptionClass e) {\n");
- sb.append(" statements;\n");
- sb.append(" } finally {\n");
- sb.append(" statements;\n");
- sb.append(" }\n");
- sb.append(" }\n");
- sb.append("}\n");
+ sb.append( "public class Test {\n" );
+ sb.append( " public int tryCatch(int condition) {\n" );
+ sb.append( " try {\n" );
+ sb.append( " statements;\n" );
+ sb.append( " } catch (ExceptionClass e) {\n" );
+ sb.append( " statements;\n" );
+ sb.append( " }\n" );
+ sb.append( "\n" );
+ sb.append( " try {\n" );
+ sb.append( " statements;\n" );
+ sb.append( " } catch (ExceptionClass e) {\n" );
+ sb.append( " statements;\n" );
+ sb.append( " } finally {\n" );
+ sb.append( " statements;\n" );
+ sb.append( " }\n" );
+ sb.append( " }\n" );
+ sb.append( "}\n" );
Beautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- String after = beautifier.beautify(sb.toString());
- assertTrue("returned text was null", after != null);
- assertTrue("'try/catch' test failed:\nexpected:\n" + sb.toString() + \
"\nbut was:\n" + after, sb.toString().equals(after));
- } catch (Exception e) {
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( sb.toString() );
+ assertTrue( "returned text was null", after != null );
+ assertTrue( "'try/catch' test failed:\nexpected:\n" + sb.toString() + \
"\nbut was:\n" + after, sb.toString().equals( after ) ); + }
+ catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
@@ -453,43 +492,44 @@
// the (.
try {
StringBuilder before = new StringBuilder();
- before.append("public class Test {\n");
- before.append(" public int noSpaceAfter (int condition) {\n");
- before.append(" // space after for, while, and return\n");
- before.append(" for(int i = 0; i < j; i++) {\n");
- before.append(" \n");
- before.append(" }\n");
- before.append(" while(true);\n");
- before.append(" return(i > 10 ? 1 : -1);\n");
- before.append(" }\n");
- before.append("}\n");
+ before.append( "public class Test {\n" );
+ before.append( " public int noSpaceAfter (int condition) {\n" );
+ before.append( " // space after for, while, and return\n" );
+ before.append( " for(int i = 0; i < j; i++) {\n" );
+ before.append( " \n" );
+ before.append( " }\n" );
+ before.append( " while(true);\n" );
+ before.append( " return(i > 10 ? 1 : -1);\n" );
+ before.append( " }\n" );
+ before.append( "}\n" );
StringBuilder answer = new StringBuilder();
- answer.append("public class Test {\n");
- answer.append(" public int noSpaceAfter(int condition) {\n");
- answer.append(" // space after for, while, and return\n");
- answer.append(" for (int i = 0; i < j; i++) {\n");
- answer.append("\n");
- answer.append(" }\n");
- answer.append(" while (true);\n");
- answer.append(" return (i > 10 ? 1 : -1);\n");
- answer.append(" }\n");
- answer.append("}\n");
+ answer.append( "public class Test {\n" );
+ answer.append( " public int noSpaceAfter(int condition) {\n" );
+ answer.append( " // space after for, while, and return\n" );
+ answer.append( " for (int i = 0; i < j; i++) {\n" );
+ answer.append( "\n" );
+ answer.append( " }\n" );
+ answer.append( " while (true);\n" );
+ answer.append( " return (i > 10 ? 1 : -1);\n" );
+ answer.append( " }\n" );
+ answer.append( "}\n" );
Beautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- String after = beautifier.beautify(before.toString());
- assertTrue("returned text was null", after != null);
- assertTrue("'keyword and method padding' test failed:\nexpected:\n" + \
answer.toString() + "\nbut was:\n" + after, \
answer.toString().equals(after));
- } catch (Exception e) {
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( before.toString() );
+ assertTrue( "returned text was null", after != null );
+ assertTrue( "'keyword and method padding' test failed:\nexpected:\n" + \
answer.toString() + "\nbut was:\n" + after, answer.toString().equals( after ) ); + \
} + catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
@@ -498,56 +538,57 @@
// test the various forms of annotations, including annotation type \
declarations try {
StringBuilder sb = new StringBuilder();
- sb.append("public class Test {\n");
- sb.append("\n");
- sb.append(" @Test\n");
- sb.append(" public int markerAnnotation(int condition) {\n");
- sb.append(" }\n");
- sb.append("\n");
- sb.append(" @SuppressWarnings(value = \"unchecked\")\n");
- sb.append(" public void methodName() {\n");
- sb.append("\n");
- sb.append(" }\n");
- sb.append("\n");
- sb.append(" @SuppressWarnings({\"unchecked\", \"deprecation\"})\n");
- sb.append(" public void methodName() {\n");
- sb.append("\n");
- sb.append(" }\n");
- sb.append("\n");
- sb.append(" @Test\n");
- sb.append(" public int markerAnnotation(int condition) {\n");
- sb.append(" }\n");
- sb.append("\n");
- sb.append("}\n");
- sb.append("\n");
- sb.append("public @interface RequestForEnhancement {\n");
- sb.append(" int id();\n");
- sb.append(" String synopsis();\n");
- sb.append(" String engineer() default \"[unassigned]\";\n");
- sb.append(" String date() default \"[unimplemented]\";\n");
- sb.append("}\n");
- sb.append("\n");
- sb.append("@interface RequestForEnhancement {\n");
- sb.append(" int id();\n");
- sb.append(" String synopsis();\n");
- sb.append(" String engineer() default \"[unassigned]\";\n");
- sb.append(" String date() default \"[unimplemented]\";\n");
- sb.append("}\n");
+ sb.append( "public class Test {\n" );
+ sb.append( "\n" );
+ sb.append( " @Test\n" );
+ sb.append( " public int markerAnnotation(int condition) {\n" );
+ sb.append( " }\n" );
+ sb.append( "\n" );
+ sb.append( " @SuppressWarnings(value = \"unchecked\")\n" );
+ sb.append( " public void methodName() {\n" );
+ sb.append( "\n" );
+ sb.append( " }\n" );
+ sb.append( "\n" );
+ sb.append( " @SuppressWarnings({\"unchecked\", \"deprecation\"})\n" \
); + sb.append( " public void methodName() {\n" );
+ sb.append( "\n" );
+ sb.append( " }\n" );
+ sb.append( "\n" );
+ sb.append( " @Test\n" );
+ sb.append( " public int markerAnnotation(int condition) {\n" );
+ sb.append( " }\n" );
+ sb.append( "\n" );
+ sb.append( "}\n" );
+ sb.append( "\n" );
+ sb.append( "public @interface RequestForEnhancement {\n" );
+ sb.append( " int id();\n" );
+ sb.append( " String synopsis();\n" );
+ sb.append( " String engineer() default \"[unassigned]\";\n" );
+ sb.append( " String date() default \"[unimplemented]\";\n" );
+ sb.append( "}\n" );
+ sb.append( "\n" );
+ sb.append( "@interface RequestForEnhancement {\n" );
+ sb.append( " int id();\n" );
+ sb.append( " String synopsis();\n" );
+ sb.append( " String engineer() default \"[unassigned]\";\n" );
+ sb.append( " String date() default \"[unimplemented]\";\n" );
+ sb.append( "}\n" );
Beautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- String after = beautifier.beautify(sb.toString());
- assertTrue("returned text was null", after != null);
- assertTrue("'annotations' test failed:\nexpected:\n" + sb.toString() + \
"\nbut was:\n" + after, sb.toString().equals(after));
- } catch (Exception e) {
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( sb.toString() );
+ assertTrue( "returned text was null", after != null );
+ assertTrue( "'annotations' test failed:\nexpected:\n" + sb.toString() + \
"\nbut was:\n" + after, sb.toString().equals( after ) ); + }
+ catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
@@ -556,42 +597,43 @@
// should be one blank line before each method
try {
StringBuilder sb = new StringBuilder();
- sb.append("public class Test {\n");
- sb.append("\n");
- sb.append(" @Test\n");
- sb.append(" public int markerAnnotation(int condition) {\n");
- sb.append(" }\n");
- sb.append("\n");
- sb.append(" @SuppressWarnings(value = \"unchecked\")\n");
- sb.append(" public void methodName() {\n");
- sb.append("\n");
- sb.append(" }\n");
- sb.append("\n");
- sb.append(" @SuppressWarnings({\"unchecked\", \"deprecation\"})\n");
- sb.append(" public void methodName() {\n");
- sb.append("\n");
- sb.append(" }\n");
- sb.append("\n");
- sb.append(" @Test\n");
- sb.append(" public int markerAnnotation(int condition) {\n");
- sb.append(" }\n");
- sb.append("}\n");
- sb.append("\n");
+ sb.append( "public class Test {\n" );
+ sb.append( "\n" );
+ sb.append( " @Test\n" );
+ sb.append( " public int markerAnnotation(int condition) {\n" );
+ sb.append( " }\n" );
+ sb.append( "\n" );
+ sb.append( " @SuppressWarnings(value = \"unchecked\")\n" );
+ sb.append( " public void methodName() {\n" );
+ sb.append( "\n" );
+ sb.append( " }\n" );
+ sb.append( "\n" );
+ sb.append( " @SuppressWarnings({\"unchecked\", \"deprecation\"})\n" \
); + sb.append( " public void methodName() {\n" );
+ sb.append( "\n" );
+ sb.append( " }\n" );
+ sb.append( "\n" );
+ sb.append( " @Test\n" );
+ sb.append( " public int markerAnnotation(int condition) {\n" );
+ sb.append( " }\n" );
+ sb.append( "}\n" );
+ sb.append( "\n" );
Beautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- String after = beautifier.beautify(sb.toString());
- assertTrue("returned text was null", after != null);
- assertTrue("'blank lines' test failed:\nexpected:\n" + sb.toString() + \
"\nbut was:\n" + after, sb.toString().equals(after));
- } catch (Exception e) {
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( sb.toString() );
+ assertTrue( "returned text was null", after != null );
+ assertTrue( "'blank lines' test failed:\nexpected:\n" + sb.toString() + \
"\nbut was:\n" + after, sb.toString().equals( after ) ); + }
+ catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
@@ -599,107 +641,110 @@
public void testOperatorPadding() {
try {
StringBuilder before = new StringBuilder();
- before.append("public class Test4 {\n");
- before.append(" int x = - 1;\n");
- before.append(" int y = i-j;\n");
- before.append(" float z = + 0.1;\n");
- before.append("}\n");
+ before.append( "public class Test4 {\n" );
+ before.append( " int x = - 1;\n" );
+ before.append( " int y = i-j;\n" );
+ before.append( " float z = + 0.1;\n" );
+ before.append( "}\n" );
StringBuilder answer = new StringBuilder();
- answer.append("public class Test4 {\n");
- answer.append(" int x = -1;\n");
- answer.append(" int y = i - j;\n");
- answer.append(" float z = +0.1;\n");
- answer.append("}\n");
+ answer.append( "public class Test4 {\n" );
+ answer.append( " int x = -1;\n" );
+ answer.append( " int y = i - j;\n" );
+ answer.append( " float z = +0.1;\n" );
+ answer.append( "}\n" );
Beautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- String after = beautifier.beautify(before.toString());
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ String after = beautifier.beautify( before.toString() );
- assertTrue("'operator padding' test failed:\nexpected:\n" + \
answer.toString() + "\nbut was:\n" + after, \
answer.toString().equals(after));
- } catch (Exception e) {
+ assertTrue( "'operator padding' test failed:\nexpected:\n" + \
answer.toString() + "\nbut was:\n" + after, answer.toString().equals( after ) ); + \
} + catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
-
+
@Test
public void setPadParens1() {
try {
StringBuilder before = new StringBuilder();
- before.append("public class Test4 {\n");
- before.append(" public method1() {\n");
- before.append(" System.out.println();\n");
- before.append(" System.out.println( \"some text\" );\n");
- before.append(" }\n");
- before.append("}\n");
-
+ before.append( "public class Test4 {\n" );
+ before.append( " public method1() {\n" );
+ before.append( " System.out.println();\n" );
+ before.append( " System.out.println( \"some text\" );\n" );
+ before.append( " }\n" );
+ before.append( "}\n" );
+
StringBuilder answer = new StringBuilder();
- answer.append("public class Test4 {\n");
- answer.append(" public method1() {\n");
- answer.append(" System.out.println();\n");
- answer.append(" System.out.println(\"some text\");\n");
- answer.append(" }\n");
- answer.append("}\n");
+ answer.append( "public class Test4 {\n" );
+ answer.append( " public method1() {\n" );
+ answer.append( " System.out.println();\n" );
+ answer.append( " System.out.println(\"some text\");\n" );
+ answer.append( " }\n" );
+ answer.append( "}\n" );
JavaBeautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- beautifier.setPadParens(false);
- String after = beautifier.beautify(before.toString());
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ beautifier.setPadParens( false );
+ String after = beautifier.beautify( before.toString() );
- assertTrue("'padParens1' test failed:\nexpected:\n" + answer.toString() \
+ "\nbut was:\n" + after, answer.toString().equals(after));
- } catch (Exception e) {
+ assertTrue( "'padParens1' test failed:\nexpected:\n" + answer.toString() \
+ "\nbut was:\n" + after, answer.toString().equals( after ) ); + }
+ catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
-
+
@Test
public void setPadParens2() {
try {
StringBuilder before = new StringBuilder();
- before.append("public class Test4 {\n");
- before.append(" public method1() {\n");
- before.append(" System.out.println();\n");
- before.append(" System.out.println(\"some text\");\n");
- before.append(" }\n");
- before.append("}\n");
-
+ before.append( "public class Test4 {\n" );
+ before.append( " public method1() {\n" );
+ before.append( " System.out.println();\n" );
+ before.append( " System.out.println(\"some text\");\n" );
+ before.append( " }\n" );
+ before.append( "}\n" );
+
StringBuilder answer = new StringBuilder();
- answer.append("public class Test4 {\n");
- answer.append(" public method1() {\n");
- answer.append(" System.out.println();\n");
- answer.append(" System.out.println( \"some text\" );\n");
- answer.append(" }\n");
- answer.append("}\n");
+ answer.append( "public class Test4 {\n" );
+ answer.append( " public method1() {\n" );
+ answer.append( " System.out.println();\n" );
+ answer.append( " System.out.println( \"some text\" );\n" );
+ answer.append( " }\n" );
+ answer.append( "}\n" );
JavaBeautifier beautifier = new JavaBeautifier();
- beautifier.setEditMode("java");
- beautifier.setLineSeparator("\n");
- beautifier.setTabWidth(4);
- beautifier.setIndentWidth(4);
- beautifier.setUseSoftTabs(true);
- beautifier.setWrapMargin(80);
- beautifier.setWrapMode("none");
- beautifier.setPadParens(true);
- String after = beautifier.beautify(before.toString());
+ beautifier.setEditMode( "java" );
+ beautifier.setLineSeparator( "\n" );
+ beautifier.setTabWidth(4 );
+ beautifier.setIndentWidth(4 );
+ beautifier.setUseSoftTabs( true );
+ beautifier.setWrapMargin(80 );
+ beautifier.setWrapMode( "none" );
+ beautifier.setPadParens( true );
+ String after = beautifier.beautify( before.toString() );
- assertTrue("'padParens2' test failed:\nexpected:\n" + answer.toString() \
+ "\nbut was:\n" + after, answer.toString().equals(after));
- } catch (Exception e) {
+ assertTrue( "'padParens2' test failed:\nexpected:\n" + answer.toString() \
+ "\nbut was:\n" + after, answer.toString().equals( after ) ); + }
+ catch ( Exception e ) {
e.printStackTrace();
- fail(e.getMessage());
+ fail( e.getMessage() );
}
}
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
jEdit-CVS mailing list
jEdit-CVS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jedit-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic