Changeset 392 for trunk/org.modelica.mdt.test/src/org/modelica
- Timestamp:
- 03/01/06 16:51:57 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/org.modelica.mdt.test/src/org/modelica/mdt/test/TestInnerClass.java
r370 r392 42 42 package org.modelica.mdt.test; 43 43 44 import org.eclipse.core.resources.IFile; 45 import org.eclipse.core.resources.IProject; 44 46 import org.eclipse.core.runtime.CoreException; 45 47 import org.eclipse.core.runtime.IAdaptable; … … 71 73 { 72 74 75 /* the file on which we make the changing locations test */ 76 private static final String CHANGING_FILE = "changing_file.mo"; 77 73 78 /* the test subject */ 74 79 private InnerClass componentsBananza; 75 80 private InnerClass importRichModel; 81 82 private IModelicaProject proj; 76 83 77 84 … … 82 89 83 90 /* navigate to the model 'component_bananza' */ 84 IModelicaProject proj = 85 Utility.getProject(Area51Projects.MODELICA_PROJECT_NAME); 91 proj = Utility.getProject(Area51Projects.MODELICA_PROJECT_NAME); 86 92 87 93 IModelicaSourceFile file = … … 612 618 break; 613 619 case 8: // import root_package.root_package_model 614 // TODO this is broken, fix this (folder package and all i think)620 // TODO this is broken, fix this 615 621 // assertEquals(IModelicaImport.Type.QUALIFIED, imp.getType()); 616 622 break; … … 623 629 importCounter < 4); 624 630 625 } 631 } 632 633 /** 634 * test that the when a class definiton is changed in the disk 635 * it's location is updated 636 */ 637 public void testLocationUpdates() throws CoreException, 638 ConnectException, CompilerInstantiationException, 639 UnexpectedReplyException, InvocationError 640 { 641 // 642 // /* create initial class definitons */ 643 // createClassDef(); 644 // /* 645 // * check the initial locations 646 // */ 647 // IModelicaClass clazz; 648 // IRegion defReg; 649 // 650 // /* checks on EquationComponent */ 651 // clazz = proj.getClass("EquationComponent"); 652 // assertNotNull(clazz); 653 // 654 // defReg = clazz.getLocation(); 655 // assertEquals("wrong start offset", 111, defReg.getOffset()); 656 // assertEquals("wrong length", 239-111+1, defReg.getLength()); 657 // 658 // /* checks on EquationComponent.R */ 659 // clazz = proj.getClass("EquationComponent.R"); 660 // assertNotNull(clazz); 661 // 662 // defReg = clazz.getLocation(); 663 // assertEquals("wrong start offset", 137, defReg.getOffset()); 664 // assertEquals("wrong length", 167-137+1, defReg.getLength()); 665 // 666 // 667 // /* modify class defintions */ 668 // modifyClassDef(); 669 // 670 // /* 671 // * check that locations where updated 672 // */ 673 // /* checks on EquationComponent */ 674 // clazz = proj.getClass("EquationComponent"); 675 // assertNotNull(clazz); 676 // 677 // defReg = clazz.getLocation(); 678 // assertEquals("wrong start offset", 25, defReg.getOffset()); 679 // assertEquals("wrong length", 179-25+1, defReg.getLength()); 680 // 681 // /* checks on EquationComponent.R */ 682 // clazz = proj.getClass("EquationComponent.R"); 683 // assertNotNull(clazz); 684 // 685 // defReg = clazz.getLocation(); 686 // assertEquals("wrong start offset", 76, defReg.getOffset()); 687 // assertEquals("wrong length", 106-76+1, defReg.getLength()); 688 // 689 } 690 691 /** 692 * utility function for the testLocationUpdates test 693 * 694 * overwrites the initial definitions in a source file with 695 * some modifications 696 */ 697 private void modifyClassDef() throws CoreException 698 { 699 String contents = 700 "// funny comment removed\n" + 701 "class EquationComponent\n" + 702 " /* records are nice */\n" + 703 " record R\n" + 704 " Real x,y;\n" + 705 " end R;\n" + 706 "\n" + 707 " R a,b,c;\n" + 708 "equation\n" + 709 " a = if true then b else c;\n" + 710 "end EquationComponent;"; 711 712 IProject project = proj.getWrappedProject(); 713 IFile file = project.getFile(CHANGING_FILE); 714 715 file.setContents(Utility.getByteStream(contents), true, true, null); 716 } 717 718 /** 719 * utility function for the testLocationUpdates test 720 * 721 * Creates the initial definitions in a source file 722 * 723 */ 724 private void createClassDef() throws CoreException 725 { 726 String contents = 727 "/*\n" + 728 " * However, don't ever expect you can parse\n" + 729 " * the error message from the compiler.\n" + 730 " * -- Adrian Pop\n" + 731 " */\n" + 732 "class EquationComponent\n" + 733 " record R\n" + 734 " Real x,y;\n" + 735 " end R;\n" + 736 " R a,b,c;\n" + 737 "equation\n" + 738 " a = if true then b else c;\n" + 739 "end EquationComponent;"; 740 741 IProject project = proj.getWrappedProject(); 742 IFile file = project.getFile(CHANGING_FILE); 743 744 file.create(Utility.getByteStream(contents), true, null); 745 } 626 746 }
Note: See TracChangeset
for help on using the changeset viewer.