Class ExportTestFunctions

  • All Implemented Interfaces:
    CompilerPass

    public class ExportTestFunctions
    extends java.lang.Object
    implements CompilerPass
    Generates goog.exportSymbol for test functions, so they can be recognized by the test runner, even if the code is compiled.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isTestFunction​(java.lang.String functionName)
      Whether a function is recognized as a test function.
      void process​(Node externs, Node root)
      Process the JS with root node root.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • process

        public void process​(Node externs,
                            Node root)
        Description copied from interface: CompilerPass
        Process the JS with root node root. Can modify the contents of each Node tree
        Specified by:
        process in interface CompilerPass
        Parameters:
        externs - Top of external JS tree
        root - Top of JS tree
      • isTestFunction

        public static boolean isTestFunction​(java.lang.String functionName)
        Whether a function is recognized as a test function. We follow the JsUnit convention for naming (functions should start with "test"), and we also check if it has no parameters declared.
        Parameters:
        functionName - The name of the function
        Returns:
        true if the function is recognized as a test function.