Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2006, 2009 IBM Corporation and others. |
2 |
* Copyright (c) 2006, 2012 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 19-24
Link Here
|
19 |
|
19 |
|
20 |
public class DebugAttributeTest extends AbstractRegressionTest { |
20 |
public class DebugAttributeTest extends AbstractRegressionTest { |
21 |
|
21 |
|
|
|
22 |
static { |
23 |
TESTS_NAMES = new String[]{"test007"}; |
24 |
} |
22 |
public DebugAttributeTest(String name) { |
25 |
public DebugAttributeTest(String name) { |
23 |
super(name); |
26 |
super(name); |
24 |
} |
27 |
} |
Lines 285-288
Link Here
|
285 |
assertEquals("Wrong contents", expectedOutput, result); |
288 |
assertEquals("Wrong contents", expectedOutput, result); |
286 |
} |
289 |
} |
287 |
} |
290 |
} |
|
|
291 |
|
292 |
public void test005() throws Exception { |
293 |
this.runConformTest( |
294 |
new String[] { |
295 |
"X.java", |
296 |
"public class X {\n" + |
297 |
" public static void main(String[] args) {\n" + |
298 |
" int[] i1= {1, 2, 3, 4};\n\n" + |
299 |
" foo(1, 2, 3, 4);\n\n" + |
300 |
" foo(1,\n" + |
301 |
" 2,\n" + |
302 |
" 3,\n" + |
303 |
" 4);\n" + |
304 |
" }\n" + |
305 |
" static void foo(int i1, int i2, int i3, int i4) {}\n" + |
306 |
"}", |
307 |
}, |
308 |
""); |
309 |
|
310 |
ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler(); |
311 |
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(OUTPUT_DIR + File.separator +"X.class")); |
312 |
String actualOutput = |
313 |
disassembler.disassemble( |
314 |
classFileBytes, |
315 |
"\n", |
316 |
ClassFileBytesDisassembler.DETAILED); |
317 |
|
318 |
String expectedOutput = |
319 |
" Line numbers\n" + |
320 |
" [pc: 0, line: 3]\n" + |
321 |
" [pc: 20, line: 5]\n" + |
322 |
" [pc: 27, line: 7]\n" + |
323 |
" [pc: 28, line: 8]\n" + |
324 |
" [pc: 29, line: 9]\n" + |
325 |
" [pc: 30, line: 10]\n" + |
326 |
" [pc: 34, line: 11]\n"; |
327 |
|
328 |
int index = actualOutput.indexOf(expectedOutput); |
329 |
if (index == -1 || expectedOutput.length() == 0) { |
330 |
System.out.println(Util.displayString(actualOutput, 3)); |
331 |
} |
332 |
if (index == -1) { |
333 |
assertEquals("unexpected bytecode sequence", expectedOutput, actualOutput); |
334 |
} |
335 |
} |
336 |
|
337 |
public void test006() throws Exception { |
338 |
this.runConformTest( |
339 |
new String[] { |
340 |
"X.java", |
341 |
"public class X {\n" + |
342 |
" public static void main(String[] args) {\n" + |
343 |
" int[] i1= {1, 2, 3, 4};\n\n" + |
344 |
" foo(1, 2, 3, 4);\n\n" + |
345 |
" int[] i2 = {1,\n" + |
346 |
" 2,\n" + |
347 |
" 3,\n" + |
348 |
" 4};\n" + |
349 |
" }\n" + |
350 |
" static void foo(int i1, int i2, int i3, int i4) {}\n" + |
351 |
"}", |
352 |
}, |
353 |
""); |
354 |
|
355 |
ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler(); |
356 |
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(OUTPUT_DIR + File.separator +"X.class")); |
357 |
String actualOutput = |
358 |
disassembler.disassemble( |
359 |
classFileBytes, |
360 |
"\n", |
361 |
ClassFileBytesDisassembler.DETAILED); |
362 |
|
363 |
String expectedOutput = |
364 |
" Line numbers:\n" + |
365 |
" [pc: 0, line: 3]\n" + |
366 |
" [pc: 20, line: 5]\n" + |
367 |
" [pc: 27, line: 7]\n" + |
368 |
" [pc: 28, line: 8]\n" + |
369 |
" [pc: 29, line: 9]\n" + |
370 |
" [pc: 30, line: 10]\n" + |
371 |
" [pc: 34, line: 11]\n"; |
372 |
|
373 |
int index = actualOutput.indexOf(expectedOutput); |
374 |
if (index == -1 || expectedOutput.length() == 0) { |
375 |
System.out.println(Util.displayString(actualOutput, 3)); |
376 |
} |
377 |
if (index == -1) { |
378 |
assertEquals("unexpected bytecode sequence", expectedOutput, actualOutput); |
379 |
} |
380 |
} |
381 |
|
382 |
public void test007() throws Exception { |
383 |
this.runConformTest( |
384 |
new String[] { |
385 |
"X.java", |
386 |
"public class X {\n" + |
387 |
" public static void main(String[] args) {\n" + |
388 |
" int[] i1= {1, 2, 3, 4};\n\n" + |
389 |
" foo(1, 2, 3, 4);\n" + |
390 |
" int[] i2;\n" + |
391 |
" i2 = new int[]{1,\n" + |
392 |
" 2,\n" + |
393 |
" 3,\n" + |
394 |
" 4};\n" + |
395 |
" }\n" + |
396 |
" static void foo(int i1, int i2, int i3, int i4) {}\n" + |
397 |
"}", |
398 |
}, |
399 |
""); |
400 |
|
401 |
ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler(); |
402 |
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(OUTPUT_DIR + File.separator +"X.class")); |
403 |
String actualOutput = |
404 |
disassembler.disassemble( |
405 |
classFileBytes, |
406 |
"\n", |
407 |
ClassFileBytesDisassembler.DETAILED); |
408 |
|
409 |
String expectedOutput = |
410 |
" Line numbers:\n" + |
411 |
" [pc: 0, line: 3]\n" + |
412 |
" [pc: 20, line: 5]\n" + |
413 |
" [pc: 27, line: 7]\n" + |
414 |
" [pc: 28, line: 8]\n" + |
415 |
" [pc: 29, line: 9]\n" + |
416 |
" [pc: 30, line: 10]\n" + |
417 |
" [pc: 34, line: 11]\n"; |
418 |
|
419 |
int index = actualOutput.indexOf(expectedOutput); |
420 |
if (index == -1 || expectedOutput.length() == 0) { |
421 |
System.out.println(Util.displayString(actualOutput, 3)); |
422 |
} |
423 |
if (index == -1) { |
424 |
assertEquals("unexpected bytecode sequence", expectedOutput, actualOutput); |
425 |
} |
426 |
} |
288 |
} |
427 |
} |