View | Details | Raw Unified | Return to bug 167357 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/LocalElementTests.java (+103 lines)
Lines 411-415 Link Here
411
			deleteFile("/P/X.java");
411
			deleteFile("/P/X.java");
412
		}
412
		}
413
	}
413
	}
414
    
415
    /*
416
     * Local type test.
417
     */
418
    public void testLocalType5() throws CoreException {
419
        try {
420
            createFile(
421
                "/P/X.java",
422
                "public class X {\n" +
423
                "  void foo() {\n" +
424
                "    class Y {\n" +
425
                "      {\n" +
426
                "        class Z {\n" +
427
                "        }\n" +
428
                "      }\n" +
429
                "    }\n" +
430
                "  }\n" +
431
                "}"
432
            );
433
            ICompilationUnit cu = getCompilationUnit("/P/X.java");
434
            assertElementDescendants(
435
                "Unexpected compilation unit contents",
436
                "X.java\n" + 
437
                "  class X\n" + 
438
                "    void foo()\n" + 
439
                "      class Y\n" + 
440
                "        <initializer #1>\n" + 
441
                "          class Z",
442
                cu);
443
        } finally {
444
            deleteFile("/P/X.java");
445
        }
446
    }    
414
447
448
    /*
449
     * Local type test.
450
     */
451
    public void testLocalType6() throws CoreException {
452
        try {
453
            createFile(
454
                "/P/X.java",
455
                "public class X {\n" +
456
                "  void foo() {\n" +
457
                "    class Y {\n" +
458
                "      {\n" +
459
                "        class Z {\n" +
460
                "        }\n" +
461
                "      }\n" +
462
                "      String s = null;\n" +
463
                "    }\n" +
464
                "  }\n" +
465
                "}"
466
            );
467
            ICompilationUnit cu = getCompilationUnit("/P/X.java");
468
            assertElementDescendants(
469
                "Unexpected compilation unit contents",
470
                "X.java\n" + 
471
                "  class X\n" + 
472
                "    void foo()\n" + 
473
                "      class Y\n" + 
474
                "        <initializer #1>\n" + 
475
                "          class Z\n" +
476
                "        String s", 
477
                cu);
478
        } finally {
479
            deleteFile("/P/X.java");
480
        }
481
    }         
482
    
483
    /*
484
     * Local type test.
485
     */
486
    public void testLocalType7() throws CoreException {
487
        try {
488
            createFile(
489
                "/P/X.java",
490
                "public class X {\n" +
491
                "  void foo() {\n" +
492
                "    class Y {\n" +
493
                "      String s = null;\n" +
494
                "      {\n" +
495
                "        class Z {\n" +
496
                "        }\n" +
497
                "      }\n" +
498
                "    }\n" +
499
                "  }\n" +
500
                "}"
501
            );
502
            ICompilationUnit cu = getCompilationUnit("/P/X.java");
503
            assertElementDescendants(
504
                "Unexpected compilation unit contents",
505
                "X.java\n" + 
506
                "  class X\n" + 
507
                "    void foo()\n" + 
508
                "      class Y\n" + 
509
                "        String s\n"+ 
510
                "        <initializer #1>\n" + 
511
                "          class Z",
512
                cu);
513
        } finally {
514
            deleteFile("/P/X.java");
515
        }
516
    }      
517
    
415
}
518
}

Return to bug 167357