[PATCH] D64669: [clang-doc] Fix failing tests on Windows

Julie Hockett via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 12 15:19:01 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL365967: [clang-doc] Fix failing tests on Windows (authored by juliehockett, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64669?vs=209601&id=209617#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64669/new/

https://reviews.llvm.org/D64669

Files:
  clang-tools-extra/trunk/unittests/clang-doc/HTMLGeneratorTest.cpp


Index: clang-tools-extra/trunk/unittests/clang-doc/HTMLGeneratorTest.cpp
===================================================================
--- clang-tools-extra/trunk/unittests/clang-doc/HTMLGeneratorTest.cpp
+++ clang-tools-extra/trunk/unittests/clang-doc/HTMLGeneratorTest.cpp
@@ -79,10 +79,11 @@
   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 @@
   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 @@
   </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 @@
   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 @@
   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>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64669.209617.patch
Type: text/x-patch
Size: 3115 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190712/e1f6133a/attachment-0001.bin>


More information about the cfe-commits mailing list