Skip to content

Commit

Permalink
test: code in C# documentation comment #9495
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeih committed Dec 18, 2023
1 parent ed312fb commit f2b22a6
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]);
}
}

0 comments on commit f2b22a6

Please sign in to comment.