Class CheckerFrameworkWPIPerDirectoryTest

    • Constructor Detail

      • CheckerFrameworkWPIPerDirectoryTest

        protected CheckerFrameworkWPIPerDirectoryTest​(java.util.List<java.io.File> testFiles,
                                                      java.lang.Class<? extends javax.annotation.processing.AbstractProcessor> checker,
                                                      java.lang.String testDir,
                                                      java.lang.String... checkerOptions)
        Creates a new checker test. Use this constructor when creating a generation test.

        TestConfigurationBuilder.getDefaultConfigurationBuilder(String, File, String, Iterable, Iterable, List, boolean) adds additional checker options.

        Parameters:
        testFiles - the files containing test code, which will be type-checked
        checker - the class for the checker to use
        testDir - the path to the directory of test inputs
        checkerOptions - options to pass to the compiler when running tests
    • Method Detail

      • doNotTypecheck

        protected void doNotTypecheck​(@UnderInitialization(CheckerFrameworkPerDirectoryTest.class) CheckerFrameworkWPIPerDirectoryTest this,
                                      java.lang.String endswith)
        Do not typecheck any file ending with the given String. A subclass of CheckerFrameworkWPIPerDirectoryTest uses this routine to avoid typechecking files in the all-systems test suite that are problematic for one typechecker. For example, this routine is useful when running the all-systems tests using WPI, because some all-systems tests have expected errors that become warnings during a WPI run (because of -Awarns) and so must be excluded.

        This code takes advantage of the mutability of the CheckerFrameworkPerDirectoryTest.testFiles field.

        Parameters:
        endswith - a string that the absolute path of the target file that should not be typechecked ends with. Usually, this takes the form "all-systems/ProblematicFile.java".
      • hasSkipComment

        public static boolean hasSkipComment​(java.io.File file,
                                             java.lang.String skipComment)
        Whether file contains skipComment.
        Parameters:
        file - a java test file
        skipComment - a comment that indicates that a test should be skipped
        Returns:
        whether file contains skipComment
      • resolveTestDirectory

        protected java.io.File resolveTestDirectory()
        Resolves the test root directory from the optional TestRootDirectory annotation or falls back to the default of currentDir/tests.
        Returns:
        the resolved directory
      • checkResult

        public void checkResult​(TypecheckResult typecheckResult)
        Check that the TypecheckResult did not fail.
        Parameters:
        typecheckResult - result to check