Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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>
  • Loading branch information
addaleax committed Jul 12, 2016
commit de131cb106095834d43704dff80d06268c245c29
20 changes: 20 additions & 0 deletions test/doctool/test-doctool-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,26 @@ const testData = [
'Reference/Global_Objects/Array" class="type">&lt;Array&gt;</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) {
Expand Down
47 changes: 47 additions & 0 deletions test/doctool/test-doctool-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
]
}
}
];

Expand Down
21 changes: 21 additions & 0 deletions test/fixtures/doc_with_yaml.md
Original file line number Diff line number Diff line change
@@ -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.