| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3f608b1 commit 66903f6
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -115,7 +115,7 @@ v8: | |||
| 115 | 115 | $(MAKE) -C deps/v8 $(V8_ARCH) $(V8_BUILD_OPTIONS) | |
| 116 | 116 | ||
| 117 | 117 | test: | cctest # Depends on 'all'. | |
| 118 | - $(PYTHON) tools/test.py --mode=release message parallel sequential -J | ||
| 118 | + $(PYTHON) tools/test.py --mode=release doctool message parallel sequential -J | ||
| 119 | 119 | $(MAKE) jslint | |
| 120 | 120 | $(MAKE) cpplint | |
| 121 | 121 | ||
@@ -173,7 +173,7 @@ test-all-valgrind: test-build | |||
| 173 | 173 | test-ci: | build-addons | |
| 174 | 174 | $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ | |
| 175 | 175 | --mode=release --flaky-tests=$(FLAKY_TESTS) \ | |
| 176 | - $(TEST_CI_ARGS) addons message parallel sequential | ||
| 176 | + $(TEST_CI_ARGS) addons doctool message parallel sequential | ||
| 177 | 177 | ||
| 178 | 178 | test-release: test-build | |
| 179 | 179 | $(PYTHON) tools/test.py --mode=release | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,48 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | + const fs = require('fs'); | ||
| 6 | + | ||
| 7 | + const html = require('../../tools/doc/html.js'); | ||
| 8 | + | ||
| 9 | + // Test data is a list of objects with two properties. | ||
| 10 | + // The file property is the file path. | ||
| 11 | + // The html property is some html which will be generated by the doctool. | ||
| 12 | + // This html will be stripped of all whitespace because we don't currently | ||
| 13 | + // have an html parser. | ||
| 14 | + const testData = [ | ||
| 15 | + { | ||
| 16 | + 'file': common.fixturesDir + '/sample_document.md', | ||
| 17 | + 'html': '<ol><li>fish</li><li><p>fish</p></li><li><p>Redfish</p></li>' + | ||
| 18 | + '<li>Bluefish</li></ol>' | ||
| 19 | + }, | ||
| 20 | + { | ||
| 21 | + 'file': common.fixturesDir + '/order_of_end_tags_5873.md', | ||
| 22 | + 'html': '<h3>ClassMethod: Buffer.from(array) <span> ' + | ||
| 23 | + '<a class="mark" href="#foo_class_method_buffer_from_array" ' + | ||
| 24 | + 'id="foo_class_method_buffer_from_array">#</a> </span> </h3><div' + | ||
| 25 | + 'class="signature"><ul><li><code>array</code><a ' + | ||
| 26 | + 'href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/' + | ||
| 27 | + 'Reference/Global_Objects/Array" class="type"><Array></a></li>' + | ||
| 28 | + '</ul></div>' | ||
| 29 | + }, | ||
| 30 | + ]; | ||
| 31 | + | ||
| 32 | + testData.forEach(function(item) { | ||
| 33 | + // Normalize expected data by stripping whitespace | ||
| 34 | + const expected = item.html.replace(/\s/g, ''); | ||
| 35 | + | ||
| 36 | + fs.readFile(item.file, 'utf8', common.mustCall(function(err, input) { | ||
| 37 | + assert.ifError(err); | ||
| 38 | + html(input, 'foo', 'doc/template.html', | ||
| 39 | + common.mustCall(function(err, output) { | ||
| 40 | + assert.ifError(err); | ||
| 41 | + | ||
| 42 | + const actual = output.replace(/\s/g, ''); | ||
| 43 | + // Assert that the input stripped of all whitespace contains the | ||
| 44 | + // expected list | ||
| 45 | + assert.notEqual(actual.indexOf(expected), -1); | ||
| 46 | + })); | ||
| 47 | + })); | ||
| 48 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,78 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | + const fs = require('fs'); | ||
| 6 | + | ||
| 7 | + const json = require('../../tools/doc/json.js'); | ||
| 8 | + | ||
| 9 | + // Outputs valid json with the expected fields when given simple markdown | ||
| 10 | + // Test data is a list of objects with two properties. | ||
| 11 | + // The file property is the file path. | ||
| 12 | + // The json property is some json which will be generated by the doctool. | ||
| 13 | + var testData = [ | ||
| 14 | + { | ||
| 15 | + 'file': common.fixturesDir + '/sample_document.md', | ||
| 16 | + 'json': { | ||
| 17 | + 'source': 'foo', | ||
| 18 | + 'modules': [ { 'textRaw': 'Sample Markdown', | ||
| 19 | + 'name': 'sample_markdown', | ||
| 20 | + 'modules': [ { 'textRaw':'Seussian Rhymes', | ||
| 21 | + 'name': 'seussian_rhymes', | ||
| 22 | + 'desc': '<ol>\n<li>fish</li>\n<li><p>fish</p>\n</li>\n<li>' + | ||
| 23 | + '<p>Red fish</p>\n</li>\n<li>Blue fish</li>\n</ol>\n', | ||
| 24 | + 'type': 'module', | ||
| 25 | + 'displayName': 'Seussian Rhymes' | ||
| 26 | + } ], | ||
| 27 | + 'type': 'module', | ||
| 28 | + 'displayName': 'Sample Markdown' | ||
| 29 | + } ] | ||
| 30 | + } | ||
| 31 | + }, | ||
| 32 | + { | ||
| 33 | + 'file': common.fixturesDir + '/order_of_end_tags_5873.md', | ||
| 34 | + 'json': { | ||
| 35 | + 'source':'foo', | ||
| 36 | + 'modules': [ { | ||
| 37 | + 'textRaw': 'Title', | ||
| 38 | + 'name': 'title', | ||
| 39 | + 'modules': [ { | ||
| 40 | + 'textRaw': 'Subsection', | ||
| 41 | + 'name': 'subsection', | ||
| 42 | + 'classMethods': [ { | ||
| 43 | + 'textRaw': 'Class Method: Buffer.from(array)', | ||
| 44 | + 'type':'classMethod', | ||
| 45 | + 'name':'from', | ||
| 46 | + 'signatures': [ { | ||
| 47 | + 'params': [ { | ||
| 48 | + 'textRaw': '`array` {Array} ', | ||
| 49 | + 'name': 'array', | ||
| 50 | + 'type': 'Array' | ||
| 51 | + } ] | ||
| 52 | + }, | ||
| 53 | + { | ||
| 54 | + 'params' : [ { | ||
| 55 | + 'name': 'array' | ||
| 56 | + } ] | ||
| 57 | + } | ||
| 58 | + ] | ||
| 59 | + } ], | ||
| 60 | + 'type': 'module', | ||
| 61 | + 'displayName': 'Subsection' | ||
| 62 | + } ], | ||
| 63 | + 'type': 'module', | ||
| 64 | + 'displayName': 'Title' | ||
| 65 | + } ] | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + ]; | ||
| 69 | + | ||
| 70 | + testData.forEach(function(item) { | ||
| 71 | + fs.readFile(item.file, 'utf8', common.mustCall(function(err, input) { | ||
| 72 | + assert.ifError(err); | ||
| 73 | + json(input, 'foo', common.mustCall(function(err, output) { | ||
| 74 | + assert.ifError(err); | ||
| 75 | + assert.deepStrictEqual(output, item.json); | ||
| 76 | + })); | ||
| 77 | + })); | ||
| 78 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,7 @@ | |||
| 1 | + import os | ||
| 2 | + import sys | ||
| 3 | + sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | ||
| 4 | + import testpy | ||
| 5 | + | ||
| 6 | + def GetConfiguration(context, root): | ||
| 7 | + return testpy.SimpleTestConfiguration(context, root, 'doctool') | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,6 @@ | |||
| 1 | + # Title | ||
| 2 | + | ||
| 3 | + ## Subsection | ||
| 4 | + | ||
| 5 | + ### Class Method: Buffer.from(array) | ||
| 6 | + * `array` {Array} | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,8 @@ | |||
| 1 | + # Sample Markdown | ||
| 2 | + | ||
| 3 | + ## Seussian Rhymes | ||
| 4 | + 1. fish | ||
| 5 | + 2. fish | ||
| 6 | + | ||
| 7 | + * Red fish | ||
| 8 | + * Blue fish | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1427,6 +1427,7 @@ def ExpandCommand(args): | |||
| 1427 | 1427 | 'addons', | |
| 1428 | 1428 | 'gc', | |
| 1429 | 1429 | 'debugger', | |
| 1430 | + 'doctool', | ||
| 1430 | 1431 | ] | |
| 1431 | 1432 | ||
| 1432 | 1433 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,8 +55,8 @@ if /i "%1"=="nosnapshot" set nosnapshot=1&goto arg-ok | |||
| 55 | 55 | if /i "%1"=="noetw" set noetw=1&goto arg-ok | |
| 56 | 56 | if /i "%1"=="noperfctr" set noperfctr=1&goto arg-ok | |
| 57 | 57 | if /i "%1"=="licensertf" set licensertf=1&goto arg-ok | |
| 58 | - if /i "%1"=="test" set test_args=%test_args% addons sequential parallel message -J&set jslint=1&set build_addons=1&goto arg-ok | ||
| 59 | - if /i "%1"=="test-ci" set test_args=%test_args% %test_ci_args% -p tap --logfile test.tap addons message sequential parallel&set build_addons=1&goto arg-ok | ||
| 58 | + if /i "%1"=="test" set test_args=%test_args% addons doctool sequential parallel message -J&set jslint=1&set build_addons=1&goto arg-ok | ||
| 59 | + if /i "%1"=="test-ci" set test_args=%test_args% %test_ci_args% -p tap --logfile test.tap addons doctool message sequential parallel&set build_addons=1&goto arg-ok | ||
| 60 | 60 | if /i "%1"=="test-addons" set test_args=%test_args% addons&set build_addons=1&goto arg-ok | |
| 61 | 61 | if /i "%1"=="test-simple" set test_args=%test_args% sequential parallel -J&goto arg-ok | |
| 62 | 62 | if /i "%1"=="test-message" set test_args=%test_args% message&goto arg-ok | |
| Back | FazBrowse Home | New Git URL |
0 commit comments