예제 #1
0
 public CompilationUnitImpl getCompUnit(Class<?> base, String relPath)
     throws CoreException, IOException, DartModelException {
   DartLibraryImpl lib = getDartApp();
   String expected = TestFileUtil.readResource(base, relPath);
   String fileName = relPath.substring(relPath.lastIndexOf('/') + 1);
   IFile file = getOrCreateFile(fileName, expected);
   DefaultWorkingCopyOwner wcopy = DefaultWorkingCopyOwner.getInstance();
   CompilationUnitImpl unit = new CompilationUnitImpl(lib, file, wcopy);
   String actual = unit.getSource();
   assertEquals(expected, actual);
   return unit;
 }
예제 #2
0
 private IFile getOrCreateFile(String fileName) throws CoreException, IOException {
   return getOrCreateFile(
       fileName, TestFileUtil.readResource(getClass(), "testsource/" + fileName));
 }