aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp')
-rw-r--r--clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp129
1 files changed, 0 insertions, 129 deletions
diff --git a/clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp b/clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp
index 32b0846..602058f 100644
--- a/clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp
+++ b/clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp
@@ -86,132 +86,3 @@ TEST(HTMLMustacheGeneratorTest, createResources) {
verifyFileContents(PathBuf, "JavaScript");
}
}
-
-TEST(HTMLGeneratorTest, emitFunctionHTML) {
-#if ENABLE_LOCAL_TEST
- auto G = getHTMLMustacheGenerator();
- assert(G && "Could not find HTMLMustacheGenerator");
- ClangDocContext CDCtx = getClangDocContext();
- std::string Buffer;
- llvm::raw_string_ostream Actual(Buffer);
-
- unittest::TempDir RootTestDirectory("emitRecordHTML",
- /*Unique=*/true);
- CDCtx.OutDirectory = RootTestDirectory.path();
-
- getMustacheHtmlFiles(CLANG_DOC_TEST_ASSET_DIR, CDCtx);
-
- // FIXME: This is a terrible hack, since we can't initialize the templates
- // directly. We'll need to update the interfaces so that we can call
- // SetupTemplateFiles() from outsize of HTMLMustacheGenerator.cpp
- EXPECT_THAT_ERROR(G->generateDocs(RootTestDirectory.path(), {}, CDCtx),
- Succeeded())
- << "Failed to generate docs.";
-
- CDCtx.RepositoryUrl = "http://www.repository.com";
-
- FunctionInfo I;
- I.Name = "f";
- I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
-
- I.DefLoc = Location(10, 10, "dir/test.cpp", true);
- I.Loc.emplace_back(12, 12, "test.cpp");
-
- I.Access = AccessSpecifier::AS_none;
-
- SmallString<16> PathTo;
- llvm::sys::path::native("path/to", PathTo);
- I.ReturnType = doc::TypeInfo(
- Reference(EmptySID, "float", InfoType::IT_default, "float", PathTo));
- I.Params.emplace_back(doc::TypeInfo("int", PathTo), "P");
- I.IsMethod = true;
- I.Parent = Reference(EmptySID, "Parent", InfoType::IT_record);
-
- auto Err = G->generateDocForInfo(&I, Actual, CDCtx);
- assert(!Err);
- std::string Expected = R"raw(IT_Function
-)raw";
-
- // FIXME: Functions are not handled yet.
- EXPECT_EQ(Expected, Actual.str());
-#endif
-}
-
-TEST(HTMLMustacheGeneratorTest, emitCommentHTML) {
-#if ENABLE_LOCAL_TEST
- auto G = getHTMLMustacheGenerator();
- assert(G && "Could not find HTMLMustacheGenerator");
- ClangDocContext CDCtx = getClangDocContext();
- std::string Buffer;
- llvm::raw_string_ostream Actual(Buffer);
-
- unittest::TempDir RootTestDirectory("emitCommentHTML",
- /*Unique=*/true);
- CDCtx.OutDirectory = RootTestDirectory.path();
-
- getMustacheHtmlFiles(CLANG_DOC_TEST_ASSET_DIR, CDCtx);
-
- // FIXME: This is a terrible hack, since we can't initialize the templates
- // directly. We'll need to update the interfaces so that we can call
- // SetupTemplateFiles() from outsize of HTMLMustacheGenerator.cpp
- EXPECT_THAT_ERROR(G->generateDocs(RootTestDirectory.path(), {}, CDCtx),
- Succeeded())
- << "Failed to generate docs.";
-
- CDCtx.RepositoryUrl = "http://www.repository.com";
-
- FunctionInfo I;
- I.Name = "f";
- I.DefLoc = Location(10, 10, "test.cpp", true);
- I.ReturnType = doc::TypeInfo("void");
- I.Params.emplace_back(doc::TypeInfo("int"), "I");
- I.Params.emplace_back(doc::TypeInfo("int"), "J");
- I.Access = AccessSpecifier::AS_none;
-
- CommentInfo Top;
- Top.Kind = "FullComment";
-
- Top.Children.emplace_back(std::make_unique<CommentInfo>());
- CommentInfo *BlankLine = Top.Children.back().get();
- BlankLine->Kind = "ParagraphComment";
- BlankLine->Children.emplace_back(std::make_unique<CommentInfo>());
- BlankLine->Children.back()->Kind = "TextComment";
-
- Top.Children.emplace_back(std::make_unique<CommentInfo>());
- CommentInfo *Brief = Top.Children.back().get();
- Brief->Kind = "ParagraphComment";
- Brief->Children.emplace_back(std::make_unique<CommentInfo>());
- Brief->Children.back()->Kind = "TextComment";
- Brief->Children.back()->Name = "ParagraphComment";
- Brief->Children.back()->Text = " Brief description.";
-
- Top.Children.emplace_back(std::make_unique<CommentInfo>());
- CommentInfo *Extended = Top.Children.back().get();
- Extended->Kind = "ParagraphComment";
- Extended->Children.emplace_back(std::make_unique<CommentInfo>());
- Extended->Children.back()->Kind = "TextComment";
- Extended->Children.back()->Text = " Extended description that";
- Extended->Children.emplace_back(std::make_unique<CommentInfo>());
- Extended->Children.back()->Kind = "TextComment";
- Extended->Children.back()->Text = " continues onto the next line.";
-
- Top.Children.emplace_back(std::make_unique<CommentInfo>());
- CommentInfo *Entities = Top.Children.back().get();
- Entities->Kind = "ParagraphComment";
- Entities->Children.emplace_back(std::make_unique<CommentInfo>());
- Entities->Children.back()->Kind = "TextComment";
- Entities->Children.back()->Name = "ParagraphComment";
- Entities->Children.back()->Text =
- " Comment with html entities: &, <, >, \", \'.";
-
- I.Description.emplace_back(std::move(Top));
-
- auto Err = G->generateDocForInfo(&I, Actual, CDCtx);
- assert(!Err);
- std::string Expected = R"raw(IT_Function
-)raw";
-
- // FIXME: Functions are not handled yet.
- EXPECT_EQ(Expected, Actual.str());
-#endif
-}