summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests
diff options
context:
space:
mode:
authorJulie Hockett <juliehockett@google.com>2019-07-12 22:19:02 +0000
committerJulie Hockett <juliehockett@google.com>2019-07-12 22:19:02 +0000
commitb131ad0be2849fe367eac4ad7cc6eca198a08a28 (patch)
treed217afd47354a75ca8e1a0b1a0bc576bc374ce2b /clang-tools-extra/unittests
parentec2abbafda627963e600c890ddf06ec3b7a1b399 (diff)
downloadbcm5719-llvm-b131ad0be2849fe367eac4ad7cc6eca198a08a28.tar.gz
bcm5719-llvm-b131ad0be2849fe367eac4ad7cc6eca198a08a28.zip
[clang-doc] Fix failing tests on Windows
Tests on Windows were failing due to path separator differences. '/' was being used as separator in the expected output, paths in expected output are now changed to their native form before comparing them to the actual output. Committed on behalf of Diego Astiazarán (diegoaat97@gmail.com). Differential Revision: https://reviews.llvm.org/D64669 llvm-svn: 365967
Diffstat (limited to 'clang-tools-extra/unittests')
-rw-r--r--clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp b/clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
index e95ceb878a6..eabc6d45fe5 100644
--- a/clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
+++ b/clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
@@ -79,10 +79,11 @@ TEST(HTMLGeneratorTest, emitRecordHTML) {
I.DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"});
I.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"});
+ SmallString<16> PathTo;
+ llvm::sys::path::native("path/to", PathTo);
I.Members.emplace_back("int", "X/Y", "X", AccessSpecifier::AS_private);
I.TagType = TagTypeKind::TTK_Class;
- I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record,
- llvm::SmallString<128>("path/to"));
+ I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record, PathTo);
I.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record);
I.ChildRecords.emplace_back(EmptySID, "ChildStruct", InfoType::IT_record);
@@ -97,6 +98,10 @@ TEST(HTMLGeneratorTest, emitRecordHTML) {
llvm::raw_string_ostream Actual(Buffer);
auto Err = G->generateDocForInfo(&I, Actual);
assert(!Err);
+ SmallString<16> PathToF;
+ llvm::sys::path::native("../../../path/to/F.html", PathToF);
+ SmallString<16> PathToInt;
+ llvm::sys::path::native("../int.html", PathToInt);
std::string Expected = R"raw(<!DOCTYPE html>
<meta charset="utf-8"/>
<title>class r</title>
@@ -107,12 +112,14 @@ TEST(HTMLGeneratorTest, emitRecordHTML) {
</p>
<p>
Inherits from
- <a href="../../../path/to/F.html">F</a>
+ <a href=")raw" + std::string(PathToF.str()) +
+ R"raw(">F</a>
, G
</p>
<h2>Members</h2>
<ul>
- <li>private <a href="../int.html">int</a> X</li>
+ <li>private <a href=")raw" +
+ std::string(PathToInt.str()) + R"raw(">int</a> X</li>
</ul>
<h2>Records</h2>
<ul>
@@ -143,8 +150,10 @@ TEST(HTMLGeneratorTest, emitFunctionHTML) {
I.DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"});
I.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"});
- I.ReturnType = TypeInfo(EmptySID, "float", InfoType::IT_default, "path/to");
- I.Params.emplace_back("int", "path/to", "P");
+ SmallString<16> PathTo;
+ llvm::sys::path::native("path/to", PathTo);
+ I.ReturnType = TypeInfo(EmptySID, "float", InfoType::IT_default, PathTo);
+ I.Params.emplace_back("int", PathTo, "P");
I.IsMethod = true;
I.Parent = Reference(EmptySID, "Parent", InfoType::IT_record);
@@ -154,15 +163,21 @@ TEST(HTMLGeneratorTest, emitFunctionHTML) {
llvm::raw_string_ostream Actual(Buffer);
auto Err = G->generateDocForInfo(&I, Actual);
assert(!Err);
+ SmallString<16> PathToFloat;
+ llvm::sys::path::native("path/to/float.html", PathToFloat);
+ SmallString<16> PathToInt;
+ llvm::sys::path::native("path/to/int.html", PathToInt);
std::string Expected = R"raw(<!DOCTYPE html>
<meta charset="utf-8"/>
<title></title>
<div>
<h3>f</h3>
<p>
- <a href="path/to/float.html">float</a>
+ <a href=")raw" + std::string(PathToFloat.str()) +
+ R"raw(">float</a>
f(
- <a href="path/to/int.html">int</a>
+ <a href=")raw" + std::string(PathToInt.str()) +
+ R"raw(">int</a>
P)
</p>
<p>
OpenPOWER on IntegriCloud