llvm/clang/unittests/AST/CommentParser.cpp

//===- unittests/AST/CommentParser.cpp ------ Comment parser tests --------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "clang/AST/CommentParser.h"
#include "clang/AST/Comment.h"
#include "clang/AST/CommentCommandTraits.h"
#include "clang/AST/CommentLexer.h"
#include "clang/AST/CommentSema.h"
#include "clang/Basic/CommentOptions.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Allocator.h"
#include "gtest/gtest.h"

usingnamespacellvm;
usingnamespaceclang;

namespace clang {
namespace comments {

namespace {

const bool MY_DEBUG =;

class CommentParserTest : public ::testing::Test {};

FullComment *CommentParserTest::parseString(const char *Source) {}

::testing::AssertionResult HasChildCount(const Comment *C, size_t Count) {}

template <typename T>
::testing::AssertionResult GetChildAt(const Comment *C,
                                      size_t Idx,
                                      T *&Child) {}

::testing::AssertionResult HasTextAt(const Comment *C,
                                     size_t Idx,
                                     StringRef Text) {}

::testing::AssertionResult HasTextWithNewlineAt(const Comment *C,
                                                size_t Idx,
                                                StringRef Text) {}

::testing::AssertionResult HasBlockCommandAt(const Comment *C,
                                             const CommandTraits &Traits,
                                             size_t Idx,
                                             BlockCommandComment *&BCC,
                                             StringRef Name,
                                             ParagraphComment *&Paragraph) {}

::testing::AssertionResult
HasParamCommandAt(const Comment *C, const CommandTraits &Traits, size_t Idx,
                  ParamCommandComment *&PCC, StringRef CommandName,
                  ParamCommandPassDirection Direction, bool IsDirectionExplicit,
                  StringRef ParamName, ParagraphComment *&Paragraph) {}

::testing::AssertionResult HasTParamCommandAt(
                              const Comment *C,
                              const CommandTraits &Traits,
                              size_t Idx,
                              TParamCommandComment *&TPCC,
                              StringRef CommandName,
                              StringRef ParamName,
                              ParagraphComment *&Paragraph) {}

::testing::AssertionResult HasInlineCommandAt(const Comment *C,
                                              const CommandTraits &Traits,
                                              size_t Idx,
                                              InlineCommandComment *&ICC,
                                              StringRef Name) {}

struct NoArgs {};

::testing::AssertionResult HasInlineCommandAt(const Comment *C,
                                              const CommandTraits &Traits,
                                              size_t Idx,
                                              InlineCommandComment *&ICC,
                                              StringRef Name,
                                              NoArgs) {}

::testing::AssertionResult HasInlineCommandAt(const Comment *C,
                                              const CommandTraits &Traits,
                                              size_t Idx,
                                              InlineCommandComment *&ICC,
                                              StringRef Name,
                                              StringRef Arg) {}

::testing::AssertionResult HasHTMLStartTagAt(const Comment *C,
                                             size_t Idx,
                                             HTMLStartTagComment *&HST,
                                             StringRef TagName) {}

struct SelfClosing {};

::testing::AssertionResult HasHTMLStartTagAt(const Comment *C,
                                             size_t Idx,
                                             HTMLStartTagComment *&HST,
                                             StringRef TagName,
                                             SelfClosing) {}


struct NoAttrs {};

::testing::AssertionResult HasHTMLStartTagAt(const Comment *C,
                                             size_t Idx,
                                             HTMLStartTagComment *&HST,
                                             StringRef TagName,
                                             NoAttrs) {}

::testing::AssertionResult HasHTMLStartTagAt(const Comment *C,
                                             size_t Idx,
                                             HTMLStartTagComment *&HST,
                                             StringRef TagName,
                                             StringRef AttrName,
                                             StringRef AttrValue) {}

::testing::AssertionResult HasHTMLEndTagAt(const Comment *C,
                                           size_t Idx,
                                           HTMLEndTagComment *&HET,
                                           StringRef TagName) {}

::testing::AssertionResult HasParagraphCommentAt(const Comment *C,
                                                 size_t Idx,
                                                 StringRef Text) {}

::testing::AssertionResult HasVerbatimBlockAt(const Comment *C,
                                              const CommandTraits &Traits,
                                              size_t Idx,
                                              VerbatimBlockComment *&VBC,
                                              StringRef Name,
                                              StringRef CloseName) {}

struct NoLines {};
struct Lines {};

::testing::AssertionResult HasVerbatimBlockAt(const Comment *C,
                                              const CommandTraits &Traits,
                                              size_t Idx,
                                              VerbatimBlockComment *&VBC,
                                              StringRef Name,
                                              StringRef CloseName,
                                              NoLines) {}

::testing::AssertionResult HasVerbatimBlockAt(const Comment *C,
                                              const CommandTraits &Traits,
                                              size_t Idx,
                                              VerbatimBlockComment *&VBC,
                                              StringRef Name,
                                              StringRef CloseName,
                                              Lines,
                                              StringRef Line0) {}

::testing::AssertionResult HasVerbatimBlockAt(const Comment *C,
                                              const CommandTraits &Traits,
                                              size_t Idx,
                                              VerbatimBlockComment *&VBC,
                                              StringRef Name,
                                              StringRef CloseName,
                                              Lines,
                                              StringRef Line0,
                                              StringRef Line1) {}

::testing::AssertionResult HasVerbatimLineAt(const Comment *C,
                                             const CommandTraits &Traits,
                                             size_t Idx,
                                             VerbatimLineComment *&VLC,
                                             StringRef Name,
                                             StringRef Text) {}


TEST_F(CommentParserTest, Basic1) {}

TEST_F(CommentParserTest, Basic2) {}

TEST_F(CommentParserTest, Basic3) {}

TEST_F(CommentParserTest, ParagraphSplitting1) {}

TEST_F(CommentParserTest, Paragraph1) {}

TEST_F(CommentParserTest, Paragraph2) {}

TEST_F(CommentParserTest, Paragraph3) {}

TEST_F(CommentParserTest, ParamCommand1) {}

TEST_F(CommentParserTest, ParamCommand2) {}

TEST_F(CommentParserTest, ParamCommand3) {}

TEST_F(CommentParserTest, ParamCommand4) {}

TEST_F(CommentParserTest, ParamCommand5) {}

TEST_F(CommentParserTest, ParamCommand6) {}

TEST_F(CommentParserTest, ParamCommand7) {}

TEST_F(CommentParserTest, TParamCommand1) {}

TEST_F(CommentParserTest, TParamCommand2) {}


TEST_F(CommentParserTest, InlineCommand1) {}

TEST_F(CommentParserTest, InlineCommand2) {}

TEST_F(CommentParserTest, InlineCommand3) {}

TEST_F(CommentParserTest, InlineCommand4) {}

TEST_F(CommentParserTest, InlineCommand5) {}

TEST_F(CommentParserTest, HTML1) {}

TEST_F(CommentParserTest, HTML2) {}

TEST_F(CommentParserTest, HTML3) {}

TEST_F(CommentParserTest, HTML4) {}

TEST_F(CommentParserTest, HTML5) {}

TEST_F(CommentParserTest, HTML6) {}

TEST_F(CommentParserTest, VerbatimBlock1) {}

TEST_F(CommentParserTest, VerbatimBlock2) {}

TEST_F(CommentParserTest, VerbatimBlock3) {}

TEST_F(CommentParserTest, VerbatimBlock4) {}

TEST_F(CommentParserTest, VerbatimBlock5) {}

TEST_F(CommentParserTest, VerbatimBlock6) {}

TEST_F(CommentParserTest, VerbatimBlock7) {}

TEST_F(CommentParserTest, VerbatimBlock8) {}

TEST_F(CommentParserTest, VerbatimLine1) {}

TEST_F(CommentParserTest, VerbatimLine2) {}

TEST_F(CommentParserTest, Deprecated) {}

TEST_F(CommentParserTest, ThrowsCommandHasArg1) {}

TEST_F(CommentParserTest, ThrowsCommandHasArg2) {}

TEST_F(CommentParserTest, ThrowsCommandHasArg3) {}

TEST_F(CommentParserTest, ThrowsCommandHasArg4) {}

TEST_F(CommentParserTest, ThrowsCommandHasArg5) {}

TEST_F(CommentParserTest, ThrowsCommandHasArg6) {}

// No matter the number of (unmatched) opening brackets, no type is parsed.
TEST_F(CommentParserTest, ThrowsCommandHasArg7) {}

// Types with a non-matching closing bracket are parsed as if they are a type
TEST_F(CommentParserTest, ThrowsCommandHasArg8) {}

// Everying up until the end of the paragraph comment will be
// eaten up if the template sequence is unterminated (i.e. number of
// opening and closing brackets is not equal).
TEST_F(CommentParserTest, ThrowsCommandHasArg9) {}

TEST_F(CommentParserTest, ParCommandHasArg1) {}

TEST_F(CommentParserTest, ParCommandHasArg2) {}

TEST_F(CommentParserTest, ParCommandHasArg3) {}

TEST_F(CommentParserTest, ParCommandHasArg4) {}

TEST_F(CommentParserTest, ParCommandHasArg5) {}

} // unnamed namespace

} // end namespace comments
} // end namespace clang