Skip to content

Commit

Permalink
test: code in C# documentation comment #9495 (#9536)
Browse files Browse the repository at this point in the history
* test: code in C# documentation comment #9495

* ignoreLineEndingDifferences
  • Loading branch information
yufeih authored Dec 18, 2023
1 parent 1613584 commit 2dd7f20
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions test/Docfx.Dotnet.Tests/XmlCommentUnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -487,4 +487,47 @@ public void ParseXmlCommentWithoutRootNode()
var commentModel = XmlComment.Parse(input, new XmlCommentParserContext());
Assert.Equal("A", commentModel.Summary);
}

[Fact]
public void Issue9495()
{
var comment = XmlComment.Parse(
"""
<example>
<code><![CDATA[
options.UseRelativeLinks = true;
]]></code>
<code><![CDATA[
{
"type": "articles",
"id": "4309",
"relationships": {
"author": {
"links": {
"self": "/api/shopping/articles/4309/relationships/author",
"related": "/api/shopping/articles/4309/author"
}
}
}
}
]]></code>
</example>
""");
Assert.Equal(
"""
<pre><code class="lang-csharp">options.UseRelativeLinks = true;</code></pre>
<pre><code class="lang-csharp">{
"type": "articles",
"id": "4309",
"relationships": {
"author": {
"links": {
"self": "/api/shopping/articles/4309/relationships/author",
"related": "/api/shopping/articles/4309/author"
}
}
}
}</code></pre>
""", comment.Examples[0], ignoreLineEndingDifferences: true);
}
}

0 comments on commit 2dd7f20

Please sign in to comment.