Examples of PdttFile


Examples of org.eclipse.php.core.tests.PdttFile

    for (String testsDirectory : TEST_DIRS) {

      for (final String fileName : getPDTTFiles(testsDirectory)) {
        try {
          final PdttFile pdttFile = new PdttFile(fileName);
          filesMap.put(pdttFile, null);

          suite.addTest(new PHP54ErrorReportingTests("/" + fileName) {

            protected void runTest() throws Throwable {
              IFile file = filesMap.get(pdttFile);

              StringBuilder buf = new StringBuilder();

              IMarker[] markers = file.findMarkers(
                  DefaultProblem.MARKER_TYPE_PROBLEM, true,
                  IResource.DEPTH_ZERO);
              Arrays.sort(markers, new MarkerComparator());
              for (IMarker marker : markers) {
                buf.append("\n[line=");
                buf.append(marker
                    .getAttribute(IMarker.LINE_NUMBER));
                buf.append(", start=");
                buf.append(marker
                    .getAttribute(IMarker.CHAR_START));
                buf.append(", end=");
                buf.append(marker
                    .getAttribute(IMarker.CHAR_END));
                buf.append("] ");
                buf.append(marker.getAttribute(IMarker.MESSAGE))
                    .append('\n');
              }

              assertContents(pdttFile.getExpected(),
                  buf.toString());
            }
          });
        } catch (final Exception e) {
          suite.addTest(new TestCase(fileName) { // dummy test
View Full Code Here

Examples of org.eclipse.php.core.tests.PdttFile

    for (String testsDirectory : TEST_DIRS) {

      for (final String fileName : getPDTTFiles(testsDirectory)) {
        try {
          final PdttFile pdttFile = new PdttFile(fileName);
          filesMap.put(pdttFile, null);

          suite.addTest(new PHP5ErrorReportingTests("/" + fileName) {

            protected void runTest() throws Throwable {
              IFile file = filesMap.get(pdttFile);

              StringBuilder buf = new StringBuilder();

              IMarker[] markers = file.findMarkers(
                  DefaultProblem.MARKER_TYPE_PROBLEM, true,
                  IResource.DEPTH_ZERO);

              Arrays.sort(markers, new MarkerComparator());
              for (IMarker marker : markers) {
                buf.append("\n[line=");
                buf.append(marker
                    .getAttribute(IMarker.LINE_NUMBER));
                buf.append(", start=");
                buf.append(marker
                    .getAttribute(IMarker.CHAR_START));
                buf.append(", end=");
                buf.append(marker
                    .getAttribute(IMarker.CHAR_END));
                buf.append("] ");
                buf.append(marker.getAttribute(IMarker.MESSAGE))
                    .append('\n');
              }

              assertContents(pdttFile.getExpected(),
                  buf.toString());
            }
          });
        } catch (final Exception e) {
          suite.addTest(new TestCase(fileName) { // dummy test
View Full Code Here

Examples of org.eclipse.php.core.tests.PdttFile

    for (String testsDirectory : TEST_DIRS) {

      for (final String fileName : getPDTTFiles(testsDirectory)) {
        try {
          final PdttFile pdttFile = new PdttFile(fileName);
          filesMap.put(pdttFile, null);

          suite.addTest(new PHP55ErrorReportingTests("/" + fileName) {

            protected void runTest() throws Throwable {
              IFile file = filesMap.get(pdttFile);

              StringBuilder buf = new StringBuilder();

              IMarker[] markers = file.findMarkers(
                  DefaultProblem.MARKER_TYPE_PROBLEM, true,
                  IResource.DEPTH_ZERO);
              Arrays.sort(markers, new MarkerComparator());
              for (IMarker marker : markers) {
                buf.append("\n[line=");
                buf.append(marker
                    .getAttribute(IMarker.LINE_NUMBER));
                buf.append(", start=");
                buf.append(marker
                    .getAttribute(IMarker.CHAR_START));
                buf.append(", end=");
                buf.append(marker
                    .getAttribute(IMarker.CHAR_END));
                buf.append("] ");
                buf.append(marker.getAttribute(IMarker.MESSAGE))
                    .append('\n');
              }

              assertContents(pdttFile.getExpected(),
                  buf.toString());
            }
          });
        } catch (final Exception e) {
          suite.addTest(new TestCase(fileName) { // dummy test
View Full Code Here

Examples of org.eclipse.php.core.tests.PdttFile

      for (String testsDirectory : TESTS.get(phpVersion)) {

        for (final String fileName : getPDTTFiles(testsDirectory)) {
          try {
            final PdttFile pdttFile = new PdttFile(fileName);
            phpVerSuite.addTest(new ModelStructureTests(phpVersion
                .getAlias() + " - /" + fileName) {

              protected void setUp() throws Exception {
                PHPCoreTests.setProjectPhpVersion(project,
                    phpVersion);
              }

              protected void tearDown() throws Exception {
                if (testFile != null) {
                  testFile.delete(true, null);
                  testFile = null;
                }
              }

              protected void runTest() throws Throwable {
                ISourceModule sourceModule = createFile(pdttFile
                    .getFile());

                ByteArrayOutputStream stream = new ByteArrayOutputStream();
                PrintStream printStream = new PrintStream(
                    stream);
                sourceModule.accept(new PrintVisitor(
                    printStream));
                printStream.close();

                assertContents(pdttFile.getExpected(),
                    stream.toString());
              }
            });
          } catch (final Exception e) {
            phpVerSuite.addTest(new TestCase(fileName) { // dummy
View Full Code Here

Examples of org.eclipse.php.core.tests.PdttFile

    TestSuite suite = new TestSuite("PHPDoc Parser Tests");

    for (String testsDirectory : TEST_DIRS) {
      for (final String fileName : getPDTTFiles(testsDirectory)) {
        try {
          final PdttFile pdttFile = new PdttFile(fileName);
          suite.addTest(new PHPDocParserTests("/" + fileName) {

            protected void runTest() throws Throwable {

              byte[] code = pdttFile.getFile().trim().getBytes();
              InputStreamReader reader = new InputStreamReader(
                  new ByteArrayInputStream(code));
              DocumentorLexer lexer = new DocumentorLexer(reader);
              PHPDocBlock phpDocBlock = lexer.parse();
              assertContents(pdttFile.getExpected(),
                  ASTPrintVisitor.toXMLString(phpDocBlock));
            }
          });
        } catch (final Exception e) {
          // dummy test indicating PDTT file parsing failure
View Full Code Here

Examples of org.eclipse.php.core.tests.PdttFile

      for (String testsDirectory : TESTS.get(phpVersion)) {

        for (final String fileName : getPDTTFiles(testsDirectory)) {
          try {
            final PdttFile pdttFile = new PdttFile(fileName);
            phpVerSuite.addTest(new CompilerParserTests(phpVersion
                .getAlias() + " - /" + fileName) {

              protected void runTest() throws Throwable {

                ByteArrayInputStream inputStream = new ByteArrayInputStream(
                    pdttFile.getFile().trim().getBytes());
                IModuleDeclaration moduleDeclaration = parser
                    .parse(new InputStreamReader(
                        inputStream),
                        null,
                        ProjectOptions
                            .useShortTags((IProject) null));
                String actual = ASTPrintVisitor
                    .toXMLString((ASTNode) moduleDeclaration);
                assertContents(pdttFile.getExpected(), actual);
              }
            });
          } catch (final Exception e) {
            // dummy test indicating PDTT file parsing failure
            phpVerSuite.addTest(new TestCase(fileName) {
View Full Code Here

Examples of org.eclipse.php.core.tests.PdttFile

      testsDirectory = testsDirectory.replaceAll("project", map.get(
          ProjectSuite.PROJECT).toString());
      for (final String fileName : getPDTTFiles(testsDirectory,
          PHPCorePerformanceTests.getDefault().getBundle())) {
        try {
          final PdttFile pdttFile = new PdttFile(
              PHPCorePerformanceTests.getDefault().getBundle(),
              fileName);
          MarkOccurrenceTests test = new MarkOccurrenceTests(
              phpVersion.getAlias() + " - /" + fileName) {

            protected void setUp() throws Exception {
              PHPCoreTests.setProjectPhpVersion(project,
                  phpVersion);
              pdttFile.applyPreferences();
            }

            protected void tearDown() throws Exception {
              if (testFile != null) {
                testFile.delete(true, null);
                testFile = null;
              }
            }

            protected void runTest() throws Throwable {
              runMarkOccurrence(pdttFile.getFile(), fileName);
            }
          };
          suite.addTest(test);
        } catch (final Exception e) {
          suite.addTest(new TestCase(fileName) { // dummy
View Full Code Here

Examples of org.eclipse.php.core.tests.PdttFile

      for (String testsDirectory : TESTS.get(phpVersion)) {

        for (final String fileName : getPDTTFiles(testsDirectory)) {
          try {
            final PdttFile pdttFile = new PdttFile(fileName);
            phpVerSuite.addTest(new CompilerParserTests(phpVersion
                .getAlias() + " - /" + fileName) {

              protected void runTest() throws Throwable {

                ByteArrayInputStream inputStream = new ByteArrayInputStream(
                    pdttFile.getFile().trim().getBytes());
                ModuleDeclaration moduleDeclaration = (ModuleDeclaration) parser
                    .parse(new InputStreamReader(
                        inputStream),
                        null,
                        ProjectOptions
                            .useShortTags((IProject) null));

                int offset = Integer.parseInt(pdttFile
                    .getConfig().get("offset"));

                UseStatement[] useStatements = ASTUtils
                    .getUseStatements(moduleDeclaration,
                        offset);

                StringBuilder builder = new StringBuilder();
                for (UseStatement s : useStatements) {
                  builder.append(s);
                }
                String actual = builder.toString();

                assertContents(pdttFile.getExpected(), actual);
              }
            });
          } catch (final Exception e) {
            // dummy test indicating PDTT file parsing failure
            phpVerSuite.addTest(new TestCase(fileName) {
View Full Code Here

Examples of org.eclipse.php.core.tests.PdttFile

          ProjectSuite.PROJECT).toString());

      for (final String fileName : getPDTTFiles(testsDirectory,
          PHPCorePerformanceTests.getDefault().getBundle())) {
        try {
          final PdttFile pdttFile = new PdttFile(
              PHPCorePerformanceTests.getDefault().getBundle(),
              fileName);
          ProgramParser test = new ProgramParser(phpVersion
              .getAlias()
              + " - /" + fileName) {

            protected void setUp() throws Exception {
              PHPCoreTests.setProjectPhpVersion(project,
                  phpVersion);
              pdttFile.applyPreferences();
            }

            protected void tearDown() throws Exception {
              if (testFile != null) {
                testFile.delete(true, null);
                testFile = null;
              }
            }

            protected void runTest() throws Throwable {
              executeParser(pdttFile.getFile(), fileName);
            }
          };
          suite.addTest(test);
        } catch (final Exception e) {
          suite.addTest(new TestCase(fileName) { // dummy
View Full Code Here

Examples of org.eclipse.php.core.tests.PdttFile

      for (String testsDirectory : TESTS.get(phpVersion)) {

        for (final String fileName : getPDTTFiles(testsDirectory)) {
          try {
            final PdttFile pdttFile = new PdttFile(fileName);
            phpVerSuite.addTest(new CompilerParserTests(phpVersion
                .getAlias() + " - /" + fileName) {

              protected void runTest() throws Throwable {

                ByteArrayInputStream inputStream = new ByteArrayInputStream(
                    pdttFile.getFile().trim().getBytes());
                ModuleDeclaration moduleDeclaration = (ModuleDeclaration) parser
                    .parse(new InputStreamReader(
                        inputStream),
                        null,
                        ProjectOptions
                            .useShortTags((IProject) null));

                final StringBuilder builder = new StringBuilder();

                moduleDeclaration
                    .traverse(new TraitUseStatementVisitor() {
                      @Override
                      public boolean visit(
                          TraitUseStatement s)
                          throws Exception {
                        builder.append(s);
                        return false;
                      }
                    });

                String actual = builder.toString();
                String expected = pdttFile.getExpected();

                assertContents(expected, actual);
              }
            });
          } catch (final Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.