1 20 21 package org.netbeans.test.editor.app.tests; 22 import java.io.PrintWriter ; 23 import org.openide.filesystems.*; 24 import org.netbeans.junit.NbTestCase; 25 import org.netbeans.junit.NbTestSuite; 26 import java.io.File ; 27 import org.netbeans.test.editor.LineDiff; 28 29 30 35 36 public class IndentationPerformer extends NbTestCase { 37 public IndentationPerformer(String name) { 38 super(name); 39 } 40 public void tearDown() throws Exception { 41 assertFile("Output does not match golden file.", getGoldenFile(), new File (getWorkDir(), this.getName() + ".ref"), new File (getWorkDir(), this.getName() + ".diff"), new LineDiff(false)); 42 } 43 44 51 52 public void testRound() throws Exception { 53 PrintWriter ref = null; 54 PrintWriter log = null; 55 String [] arguments = new String [] { 56 "/org/netbeans/test/editor/app/tests/indentation.xml", 57 "Reformatting.Round" 58 }; 59 try { 60 ref = new PrintWriter (getRef()); 61 log = new PrintWriter (getLog()); 62 new CallTestGeneric().runTest(arguments, log, ref); 63 } finally { 64 if (ref != null) ref.flush(); 65 if (log != null) log.flush(); 66 } 67 } 68 69 76 77 public void testRoundAddNewLine() throws Exception { 78 PrintWriter ref = null; 79 PrintWriter log = null; 80 String [] arguments = new String [] { 81 "/org/netbeans/test/editor/app/tests/indentation.xml", 82 "Reformatting.RoundAddNewLine" 83 }; 84 try { 85 ref = new PrintWriter (getRef()); 86 log = new PrintWriter (getLog()); 87 new CallTestGeneric().runTest(arguments, log, ref); 88 } finally { 89 if (ref != null) ref.flush(); 90 if (log != null) log.flush(); 91 } 92 } 93 94 101 102 public void testRoundAddSpace() throws Exception { 103 PrintWriter ref = null; 104 PrintWriter log = null; 105 String [] arguments = new String [] { 106 "/org/netbeans/test/editor/app/tests/indentation.xml", 107 "Reformatting.RoundAddSpace" 108 }; 109 try { 110 ref = new PrintWriter (getRef()); 111 log = new PrintWriter (getLog()); 112 new CallTestGeneric().runTest(arguments, log, ref); 113 } finally { 114 if (ref != null) ref.flush(); 115 if (log != null) log.flush(); 116 } 117 } 118 119 126 127 public void testCompound() throws Exception { 128 PrintWriter ref = null; 129 PrintWriter log = null; 130 String [] arguments = new String [] { 131 "/org/netbeans/test/editor/app/tests/indentation.xml", 132 "Reformatting.Compound" 133 }; 134 try { 135 ref = new PrintWriter (getRef()); 136 log = new PrintWriter (getLog()); 137 new CallTestGeneric().runTest(arguments, log, ref); 138 } finally { 139 if (ref != null) ref.flush(); 140 if (log != null) log.flush(); 141 } 142 } 143 144 151 152 public void testCompoundNewLine() throws Exception { 153 PrintWriter ref = null; 154 PrintWriter log = null; 155 String [] arguments = new String [] { 156 "/org/netbeans/test/editor/app/tests/indentation.xml", 157 "Reformatting.CompoundNewLine" 158 }; 159 try { 160 ref = new PrintWriter (getRef()); 161 log = new PrintWriter (getLog()); 162 new CallTestGeneric().runTest(arguments, log, ref); 163 } finally { 164 if (ref != null) ref.flush(); 165 if (log != null) log.flush(); 166 } 167 } 168 169 176 177 public void testClosingSameLine() throws Exception { 178 PrintWriter ref = null; 179 PrintWriter log = null; 180 String [] arguments = new String [] { 181 "/org/netbeans/test/editor/app/tests/indentation.xml", 182 "Reformatting.ClosingSameLine" 183 }; 184 try { 185 ref = new PrintWriter (getRef()); 186 log = new PrintWriter (getLog()); 187 new CallTestGeneric().runTest(arguments, log, ref); 188 } finally { 189 if (ref != null) ref.flush(); 190 if (log != null) log.flush(); 191 } 192 } 193 194 201 202 public void testSpecialAddNewLine() throws Exception { 203 PrintWriter ref = null; 204 PrintWriter log = null; 205 String [] arguments = new String [] { 206 "/org/netbeans/test/editor/app/tests/indentation.xml", 207 "Writting.SpecialAddNewLine" 208 }; 209 try { 210 ref = new PrintWriter (getRef()); 211 log = new PrintWriter (getLog()); 212 new CallTestGeneric().runTest(arguments, log, ref); 213 } finally { 214 if (ref != null) ref.flush(); 215 if (log != null) log.flush(); 216 } 217 } 218 219 226 227 public void testTwoBrackets() throws Exception { 228 PrintWriter ref = null; 229 PrintWriter log = null; 230 String [] arguments = new String [] { 231 "/org/netbeans/test/editor/app/tests/indentation.xml", 232 "Writting.TwoBrackets" 233 }; 234 try { 235 ref = new PrintWriter (getRef()); 236 log = new PrintWriter (getLog()); 237 new CallTestGeneric().runTest(arguments, log, ref); 238 } finally { 239 if (ref != null) ref.flush(); 240 if (log != null) log.flush(); 241 } 242 } 243 244 251 252 public void testDoWhile() throws Exception { 253 PrintWriter ref = null; 254 PrintWriter log = null; 255 String [] arguments = new String [] { 256 "/org/netbeans/test/editor/app/tests/indentation.xml", 257 "Issues.DoWhile" 258 }; 259 try { 260 ref = new PrintWriter (getRef()); 261 log = new PrintWriter (getLog()); 262 new CallTestGeneric().runTest(arguments, log, ref); 263 } finally { 264 if (ref != null) ref.flush(); 265 if (log != null) log.flush(); 266 } 267 } 268 269 276 277 public void testTernary() throws Exception { 278 PrintWriter ref = null; 279 PrintWriter log = null; 280 String [] arguments = new String [] { 281 "/org/netbeans/test/editor/app/tests/indentation.xml", 282 "Issues.Ternary" 283 }; 284 try { 285 ref = new PrintWriter (getRef()); 286 log = new PrintWriter (getLog()); 287 new CallTestGeneric().runTest(arguments, log, ref); 288 } finally { 289 if (ref != null) ref.flush(); 290 if (log != null) log.flush(); 291 } 292 } 293 } 294 | Popular Tags |