test,tools: test yaml parsing of doctool
Add checks that make sure the doctool parses metadata correctly. PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
015f4fda0e
commit
1b365f60f0
@ -27,6 +27,26 @@ const testData = [
|
||||
'Reference/Global_Objects/Array" class="type"><Array></a></li>' +
|
||||
'</ul></div>'
|
||||
},
|
||||
{
|
||||
'file': common.fixturesDir + '/doc_with_yaml.md',
|
||||
'html': '<h1>Sample Markdown with YAML info' +
|
||||
'<span><a class="mark" href="#foo_sample_markdown_with_yaml_info" ' +
|
||||
' id="foo_sample_markdown_with_yaml_info">#</a></span></h1>' +
|
||||
'<h2>Foobar<span><a class="mark" href="#foo_foobar" ' +
|
||||
'id="foo_foobar">#</a></span></h2>' +
|
||||
'<div class="api_metadata"><span>Added: v1.0.0</span></div> ' +
|
||||
'<p>Describe <code>Foobar</code> in more detail here.</p>' +
|
||||
'<h2>Deprecated thingy<span><a class="mark" ' +
|
||||
'href="#foo_deprecated_thingy" id="foo_deprecated_thingy">#</a>' +
|
||||
'</span></h2>' +
|
||||
'<div class="api_metadata"><span>Added: v1.0.0</span></div><p>Describe ' +
|
||||
'<code>Deprecated thingy</code> in more detail here.</p>' +
|
||||
'<h2>Something<span><a class="mark" href="#foo_something" ' +
|
||||
'id="foo_something">#</a></span></h2> ' +
|
||||
'<!-- This is not a metadata comment --> ' +
|
||||
'<p>Describe <code>Something</code> in more detail here. ' +
|
||||
'</p>'
|
||||
},
|
||||
];
|
||||
|
||||
testData.forEach(function(item) {
|
||||
|
@ -64,6 +64,53 @@ var testData = [
|
||||
'displayName': 'Title'
|
||||
} ]
|
||||
}
|
||||
},
|
||||
{
|
||||
'file': common.fixturesDir + '/doc_with_yaml.md',
|
||||
'json': {
|
||||
'source': 'foo',
|
||||
'modules': [
|
||||
{
|
||||
'textRaw': 'Sample Markdown with YAML info',
|
||||
'name': 'sample_markdown_with_yaml_info',
|
||||
'modules': [
|
||||
{
|
||||
'textRaw': 'Foobar',
|
||||
'name': 'foobar',
|
||||
'meta': {
|
||||
'added': 'v1.0.0'
|
||||
},
|
||||
'desc': '<p>Describe <code>Foobar</code> in more detail ' +
|
||||
'here.\n\n</p>\n',
|
||||
'type': 'module',
|
||||
'displayName': 'Foobar'
|
||||
},
|
||||
{
|
||||
'textRaw': 'Deprecated thingy',
|
||||
'name': 'deprecated_thingy',
|
||||
'meta': {
|
||||
'added': 'v1.0.0',
|
||||
'deprecated': 'v2.0.0'
|
||||
},
|
||||
'desc': '<p>Describe <code>Deprecated thingy</code> in more ' +
|
||||
'detail here.\n\n</p>\n',
|
||||
'type': 'module',
|
||||
'displayName': 'Deprecated thingy'
|
||||
},
|
||||
{
|
||||
'textRaw': 'Something',
|
||||
'name': 'something',
|
||||
'desc': '<!-- This is not a metadata comment -->\n\n<p>' +
|
||||
'Describe <code>Something</code> in more detail here.\n</p>\n',
|
||||
'type': 'module',
|
||||
'displayName': 'Something'
|
||||
}
|
||||
],
|
||||
'type': 'module',
|
||||
'displayName': 'Sample Markdown with YAML info'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
|
21
test/fixtures/doc_with_yaml.md
vendored
Normal file
21
test/fixtures/doc_with_yaml.md
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Sample Markdown with YAML info
|
||||
|
||||
## Foobar
|
||||
<!-- YAML
|
||||
added: v1.0.0
|
||||
-->
|
||||
|
||||
Describe `Foobar` in more detail here.
|
||||
|
||||
## Deprecated thingy
|
||||
<!-- YAML
|
||||
added: v1.0.0
|
||||
deprecated: v2.0.0
|
||||
-->
|
||||
|
||||
Describe `Deprecated thingy` in more detail here.
|
||||
|
||||
## Something
|
||||
<!-- This is not a metadata comment -->
|
||||
|
||||
Describe `Something` in more detail here.
|
Loading…
x
Reference in New Issue
Block a user