Class PrettyPrinterTester

java.lang.Object
de.monticore.runtime.junit.PrettyPrinterTester

public abstract class PrettyPrinterTester extends Object
Offers functions to test pretty printers
  • Constructor Details

    • PrettyPrinterTester

      public PrettyPrinterTester()
  • Method Details

    • testPrettyPrinter

      public static <N extends de.monticore.ast.ASTNode> void testPrettyPrinter(String model, de.monticore.antlr4.MCConcreteParser parser, PrettyPrinterTester.ParseFunction<N> parseFunc, Function<N,String> prettyPrintFunc, Predicate<String> additionalCheck)
      Tests pretty printing. The Model is parsed, pretty printed and parsed again. The AST of the pretty printed model is expected to be comparable to the AST of the original model.
      Type Parameters:
      N - the type of the ASTNode after parsing
      Parameters:
      model - the model to be pretty printed
      parser - the parser used to convert the model to an AST
      parseFunc - the concrete parse function used, e.g., myParser::parse_StringMyNonTerminal
      prettyPrintFunc - the actual pretty printing operation, e.g., ast -> MyMill.prettyPrint(ast, true)
      additionalCheck - additional check on the pretty printed String
    • testPrettyPrinter

      public static <N extends de.monticore.ast.ASTNode> void testPrettyPrinter(String model, de.monticore.antlr4.MCConcreteParser parser, PrettyPrinterTester.ParseFunction<N> parseFunc, Function<N,String> prettyPrintFunc)
      Tests pretty printing. The Model is parsed, pretty printed and parsed again. The AST of the pretty printed model is expected to be comparable to the AST of the original model.
      Type Parameters:
      N - the type of the ASTNode after parsing
      Parameters:
      model - the model to be pretty printed
      parser - the parser used to convert the model to an AST
      parseFunc - the concrete parse function used, e.g., myParser::parse_StringMyNonTerminal
      prettyPrintFunc - the actual pretty printing operation, e.g., ast -> MyMill.prettyPrint(ast, true)