Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8f76d7d

Browse filesBrowse files
addaleaxMyles Borins
authored andcommitted
test,tools: test yaml parsing of doctool
Add checks that make sure the doctool parses metadata correctly. PR-URL: #6495 Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
1 parent 2832a60 commit 8f76d7d
Copy full SHA for 8f76d7d

File tree

Expand file treeCollapse file tree

3 files changed

+88
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+88
-0
lines changed
Open diff view settings
Collapse file

‎test/doctool/test-doctool-html.js‎

Copy file name to clipboardExpand all lines: test/doctool/test-doctool-html.js
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,26 @@ const testData = [
2727
'Reference/Global_Objects/Array" class="type">&lt;Array&gt;</a></li>' +
2828
'</ul></div>'
2929
},
30+
{
31+
'file': common.fixturesDir + '/doc_with_yaml.md',
32+
'html': '<h1>Sample Markdown with YAML info' +
33+
'<span><a class="mark" href="#foo_sample_markdown_with_yaml_info" ' +
34+
' id="foo_sample_markdown_with_yaml_info">#</a></span></h1>' +
35+
'<h2>Foobar<span><a class="mark" href="#foo_foobar" ' +
36+
'id="foo_foobar">#</a></span></h2>' +
37+
'<div class="api_metadata"><span>Added: v1.0.0</span></div> ' +
38+
'<p>Describe <code>Foobar</code> in more detail here.</p>' +
39+
'<h2>Deprecated thingy<span><a class="mark" ' +
40+
'href="#foo_deprecated_thingy" id="foo_deprecated_thingy">#</a>' +
41+
'</span></h2>' +
42+
'<div class="api_metadata"><span>Added: v1.0.0</span></div><p>Describe ' +
43+
'<code>Deprecated thingy</code> in more detail here.</p>' +
44+
'<h2>Something<span><a class="mark" href="#foo_something" ' +
45+
'id="foo_something">#</a></span></h2> ' +
46+
'<!-- This is not a metadata comment --> ' +
47+
'<p>Describe <code>Something</code> in more detail here. ' +
48+
'</p>'
49+
},
3050
];
3151

3252
testData.forEach(function(item) {
Collapse file

‎test/doctool/test-doctool-json.js‎

Copy file name to clipboardExpand all lines: test/doctool/test-doctool-json.js
+47Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,53 @@ var testData = [
6464
'displayName': 'Title'
6565
} ]
6666
}
67+
},
68+
{
69+
'file': common.fixturesDir + '/doc_with_yaml.md',
70+
'json': {
71+
'source': 'foo',
72+
'modules': [
73+
{
74+
'textRaw': 'Sample Markdown with YAML info',
75+
'name': 'sample_markdown_with_yaml_info',
76+
'modules': [
77+
{
78+
'textRaw': 'Foobar',
79+
'name': 'foobar',
80+
'meta': {
81+
'added': 'v1.0.0'
82+
},
83+
'desc': '<p>Describe <code>Foobar</code> in more detail ' +
84+
'here.\n\n</p>\n',
85+
'type': 'module',
86+
'displayName': 'Foobar'
87+
},
88+
{
89+
'textRaw': 'Deprecated thingy',
90+
'name': 'deprecated_thingy',
91+
'meta': {
92+
'added': 'v1.0.0',
93+
'deprecated': 'v2.0.0'
94+
},
95+
'desc': '<p>Describe <code>Deprecated thingy</code> in more ' +
96+
'detail here.\n\n</p>\n',
97+
'type': 'module',
98+
'displayName': 'Deprecated thingy'
99+
},
100+
{
101+
'textRaw': 'Something',
102+
'name': 'something',
103+
'desc': '<!-- This is not a metadata comment -->\n\n<p>' +
104+
'Describe <code>Something</code> in more detail here.\n</p>\n',
105+
'type': 'module',
106+
'displayName': 'Something'
107+
}
108+
],
109+
'type': 'module',
110+
'displayName': 'Sample Markdown with YAML info'
111+
}
112+
]
113+
}
67114
}
68115
];
69116

Collapse file

‎test/fixtures/doc_with_yaml.md‎

Copy file name to clipboard
+21Lines changed: 21 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Sample Markdown with YAML info
2+
3+
## Foobar
4+
<!-- YAML
5+
added: v1.0.0
6+
-->
7+
8+
Describe `Foobar` in more detail here.
9+
10+
## Deprecated thingy
11+
<!-- YAML
12+
added: v1.0.0
13+
deprecated: v2.0.0
14+
-->
15+
16+
Describe `Deprecated thingy` in more detail here.
17+
18+
## Something
19+
<!-- This is not a metadata comment -->
20+
21+
Describe `Something` in more detail here.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.