summaryrefslogtreecommitdiff
path: root/test/doctool
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2016-05-12 13:23:07 -0700
committerRich Trott <rtrott@gmail.com>2016-05-15 18:11:43 -0700
commit9bc72ea0ded0cbe3c0e349d446787636efdb0618 (patch)
tree249e76fe924e0f965a49261998a6e509c1de72f6 /test/doctool
parent32b46d91a7677837eded79c0adcd4a31f1be9357 (diff)
downloadandroid-node-v8-9bc72ea0ded0cbe3c0e349d446787636efdb0618.tar.gz
android-node-v8-9bc72ea0ded0cbe3c0e349d446787636efdb0618.tar.bz2
android-node-v8-9bc72ea0ded0cbe3c0e349d446787636efdb0618.zip
test: refactor doctool tests
Adjust style in doctool tests to conform with predominant style of the rest of the project. The biggest changes are: * Replace string concatenation with `path.join()` * Remove unnecessary quotes from property names PR-URL: https://github.com/nodejs/node/pull/6719 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/doctool')
-rw-r--r--test/doctool/test-doctool-html.js13
-rw-r--r--test/doctool/test-doctool-json.js164
2 files changed, 91 insertions, 86 deletions
diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js
index 1eb96751cc..a8476b7234 100644
--- a/test/doctool/test-doctool-html.js
+++ b/test/doctool/test-doctool-html.js
@@ -3,6 +3,7 @@
const common = require('../common');
const assert = require('assert');
const fs = require('fs');
+const path = require('path');
const html = require('../../tools/doc/html.js');
@@ -13,13 +14,13 @@ const html = require('../../tools/doc/html.js');
// have an html parser.
const testData = [
{
- 'file': common.fixturesDir + '/sample_document.md',
- 'html': '<ol><li>fish</li><li><p>fish</p></li><li><p>Redfish</p></li>' +
+ file: path.join(common.fixturesDir, 'sample_document.md'),
+ html: '<ol><li>fish</li><li><p>fish</p></li><li><p>Redfish</p></li>' +
'<li>Bluefish</li></ol>'
},
{
- 'file': common.fixturesDir + '/order_of_end_tags_5873.md',
- 'html': '<h3>ClassMethod: Buffer.from(array) <span> ' +
+ file: path.join(common.fixturesDir, 'order_of_end_tags_5873.md'),
+ html: '<h3>ClassMethod: Buffer.from(array) <span> ' +
'<a class="mark" href="#foo_class_method_buffer_from_array" ' +
'id="foo_class_method_buffer_from_array">#</a> </span> </h3><div' +
'class="signature"><ul><li><code>array</code><a ' +
@@ -28,8 +29,8 @@ const testData = [
'</ul></div>'
},
{
- 'file': common.fixturesDir + '/doc_with_yaml.md',
- 'html': '<h1>Sample Markdown with YAML info' +
+ file: path.join(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" ' +
diff --git a/test/doctool/test-doctool-json.js b/test/doctool/test-doctool-json.js
index 79cf4ce3c3..7b9fbeb019 100644
--- a/test/doctool/test-doctool-json.js
+++ b/test/doctool/test-doctool-json.js
@@ -3,6 +3,7 @@
const common = require('../common');
const assert = require('assert');
const fs = require('fs');
+const path = require('path');
const json = require('../../tools/doc/json.js');
@@ -12,113 +13,116 @@ const json = require('../../tools/doc/json.js');
// The json property is some json which will be generated by the doctool.
var testData = [
{
- 'file': common.fixturesDir + '/sample_document.md',
- 'json': {
- 'source': 'foo',
- 'modules': [ { 'textRaw': 'Sample Markdown',
- 'name': 'sample_markdown',
- 'modules': [ { 'textRaw': 'Seussian Rhymes',
- 'name': 'seussian_rhymes',
- 'desc': '<ol>\n<li>fish</li>\n<li><p>fish</p>\n</li>\n<li>' +
+ file: path.join(common.fixturesDir, 'sample_document.md'),
+ json: {
+ source: 'foo',
+ modules: [{
+ textRaw: 'Sample Markdown',
+ name: 'sample_markdown',
+ modules: [{
+ textRaw: 'Seussian Rhymes',
+ name: 'seussian_rhymes',
+ desc: '<ol>\n<li>fish</li>\n<li><p>fish</p>\n</li>\n<li>' +
'<p>Red fish</p>\n</li>\n<li>Blue fish</li>\n</ol>\n',
- 'type': 'module',
- 'displayName': 'Seussian Rhymes'
- } ],
- 'type': 'module',
- 'displayName': 'Sample Markdown'
- } ]
+ type: 'module',
+ displayName: 'Seussian Rhymes'
+ }],
+ type: 'module',
+ displayName: 'Sample Markdown'
+ }]
}
},
{
- 'file': common.fixturesDir + '/order_of_end_tags_5873.md',
- 'json': {
- 'source': 'foo',
- 'modules': [ {
- 'textRaw': 'Title',
- 'name': 'title',
- 'modules': [ {
- 'textRaw': 'Subsection',
- 'name': 'subsection',
- 'classMethods': [ {
- 'textRaw': 'Class Method: Buffer.from(array)',
- 'type': 'classMethod',
- 'name': 'from',
- 'signatures': [ {
- 'params': [ {
- 'textRaw': '`array` {Array} ',
- 'name': 'array',
- 'type': 'Array'
- } ]
- },
+ file: path.join(common.fixturesDir, 'order_of_end_tags_5873.md'),
+ json: {
+ source: 'foo',
+ modules: [{
+ textRaw: 'Title',
+ name: 'title',
+ modules: [{
+ textRaw: 'Subsection',
+ name: 'subsection',
+ classMethods: [{
+ textRaw: 'Class Method: Buffer.from(array)',
+ type: 'classMethod',
+ name: 'from',
+ signatures: [
+ {
+ params: [{
+ textRaw: '`array` {Array} ',
+ name: 'array',
+ type: 'Array'
+ }]
+ },
{
- 'params': [ {
- 'name': 'array'
- } ]
+ params: [{
+ name: 'array'
+ }]
}
]
- } ],
- 'type': 'module',
- 'displayName': 'Subsection'
- } ],
- 'type': 'module',
- 'displayName': 'Title'
- } ]
+ }],
+ type: 'module',
+ displayName: 'Subsection'
+ }],
+ type: 'module',
+ displayName: 'Title'
+ }]
}
},
{
- 'file': common.fixturesDir + '/doc_with_yaml.md',
- 'json': {
- 'source': 'foo',
- 'modules': [
+ file: path.join(common.fixturesDir, 'doc_with_yaml.md'),
+ json: {
+ source: 'foo',
+ modules: [
{
- 'textRaw': 'Sample Markdown with YAML info',
- 'name': 'sample_markdown_with_yaml_info',
- 'modules': [
+ textRaw: 'Sample Markdown with YAML info',
+ name: 'sample_markdown_with_yaml_info',
+ modules: [
{
- 'textRaw': 'Foobar',
- 'name': 'foobar',
- 'meta': {
- 'added': ['v1.0.0']
+ textRaw: 'Foobar',
+ name: 'foobar',
+ meta: {
+ added: ['v1.0.0']
},
- 'desc': '<p>Describe <code>Foobar</code> in more detail ' +
+ desc: '<p>Describe <code>Foobar</code> in more detail ' +
'here.</p>\n',
- 'type': 'module',
- 'displayName': 'Foobar'
+ type: 'module',
+ displayName: 'Foobar'
},
{
- 'textRaw': 'Foobar II',
- 'name': 'foobar_ii',
- 'meta': {
- 'added': ['v5.3.0', 'v4.2.0']
+ textRaw: 'Foobar II',
+ name: 'foobar_ii',
+ meta: {
+ added: ['v5.3.0', 'v4.2.0']
},
- 'desc': '<p>Describe <code>Foobar II</code> in more detail ' +
+ desc: '<p>Describe <code>Foobar II</code> in more detail ' +
'here.</p>\n',
- 'type': 'module',
- 'displayName': 'Foobar II'
+ type: 'module',
+ displayName: 'Foobar II'
},
{
- 'textRaw': 'Deprecated thingy',
- 'name': 'deprecated_thingy',
- 'meta': {
- 'added': ['v1.0.0'],
- 'deprecated': ['v2.0.0']
+ textRaw: 'Deprecated thingy',
+ name: 'deprecated_thingy',
+ meta: {
+ added: ['v1.0.0'],
+ deprecated: ['v2.0.0']
},
- 'desc': '<p>Describe <code>Deprecated thingy</code> in more ' +
+ desc: '<p>Describe <code>Deprecated thingy</code> in more ' +
'detail here.</p>\n',
- 'type': 'module',
- 'displayName': 'Deprecated thingy'
+ type: 'module',
+ displayName: 'Deprecated thingy'
},
{
- 'textRaw': 'Something',
- 'name': 'something',
- 'desc': '<!-- This is not a metadata comment -->\n<p>' +
+ textRaw: 'Something',
+ name: 'something',
+ desc: '<!-- This is not a metadata comment -->\n<p>' +
'Describe <code>Something</code> in more detail here.</p>\n',
- 'type': 'module',
- 'displayName': 'Something'
+ type: 'module',
+ displayName: 'Something'
}
],
- 'type': 'module',
- 'displayName': 'Sample Markdown with YAML info'
+ type: 'module',
+ displayName: 'Sample Markdown with YAML info'
}
]
}