diff --git a/test/fixture/infer-private.input.js b/test/fixture/infer-private.input.js index ddfbdb45e..84723db96 100644 --- a/test/fixture/infer-private.input.js +++ b/test/fixture/infer-private.input.js @@ -1,3 +1,5 @@ +// Options: {"inferPrivate": "^_"} + /** * _p description */ diff --git a/test/fixture/infer-private.output.json b/test/fixture/infer-private.output.json index 37e02d82e..1b7a0a27b 100644 --- a/test/fixture/infer-private.output.json +++ b/test/fixture/infer-private.output.json @@ -1,95 +1,4 @@ [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "_p description", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - } - } - }, - "tags": [], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - }, - "context": { - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 16 - } - } - }, - "errors": [], - "name": "_p", - "kind": "function", - "members": { - "instance": [], - "static": [] - }, - "path": [ - { - "name": "_p", - "kind": "function" - } - ], - "namespace": "_p" - }, { "description": { "type": "root", @@ -146,22 +55,22 @@ "tags": [], "loc": { "start": { - "line": 6, + "line": 8, "column": 0 }, "end": { - "line": 6, + "line": 8, "column": 20 } }, "context": { "loc": { "start": { - "line": 7, + "line": 9, "column": 0 }, "end": { - "line": 12, + "line": 14, "column": 1 } } @@ -227,22 +136,22 @@ "tags": [], "loc": { "start": { - "line": 8, + "line": 10, "column": 2 }, "end": { - "line": 8, + "line": 10, "column": 22 } }, "context": { "loc": { "start": { - "line": 9, + "line": 11, "column": 2 }, "end": { - "line": 9, + "line": 11, "column": 8 } } @@ -268,104 +177,6 @@ } ], "namespace": "C#m" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "_p description", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - } - } - }, - "tags": [], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 23 - } - }, - "context": { - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 9 - } - } - }, - "errors": [], - "name": "_p", - "kind": "function", - "memberof": "C", - "scope": "instance", - "members": { - "instance": [], - "static": [] - }, - "path": [ - { - "name": "C", - "kind": "class" - }, - { - "name": "_p", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "C#_p" } ], "static": [], diff --git a/test/fixture/infer-private.output.md b/test/fixture/infer-private.output.md index e5e1e56b6..7437d067b 100644 --- a/test/fixture/infer-private.output.md +++ b/test/fixture/infer-private.output.md @@ -1,9 +1,5 @@ -# \_p - -\_p description - # C C description @@ -11,7 +7,3 @@ C description ## m m description - -## \_p - -\_p description diff --git a/test/fixture/infer-private.output.md.json b/test/fixture/infer-private.output.md.json index 58641b9da..61222fd70 100644 --- a/test/fixture/infer-private.output.md.json +++ b/test/fixture/infer-private.output.md.json @@ -5,51 +5,6 @@ "type": "html", "value": "" }, - { - "depth": 1, - "type": "heading", - "children": [ - { - "type": "text", - "value": "_p" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "_p description", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - }, - "indent": [] - } - }, { "depth": 1, "type": "heading", @@ -139,51 +94,6 @@ }, "indent": [] } - }, - { - "depth": 2, - "type": "heading", - "children": [ - { - "type": "text", - "value": "_p" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "_p description", - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - }, - "indent": [] - } - } - ], - "position": { - "start": { - "line": 1, - "column": 1, - "offset": 0 - }, - "end": { - "line": 1, - "column": 15, - "offset": 14 - }, - "indent": [] - } } ] } \ No newline at end of file diff --git a/test/test.js b/test/test.js index 9009c1ed0..91e561d0b 100644 --- a/test/test.js +++ b/test/test.js @@ -20,6 +20,18 @@ function makePOJO(ast) { return JSON.parse(JSON.stringify(ast)); } +function readOptionsFromFile(file) { + var s = fs.readFileSync(file, 'utf-8'); + var lines = s.split(/\n/, 20); + for (var i = 0; i < lines.length; i++) { + var m = lines[i].match(/^\/\/\s+Options:\s*(.+)$/); + if (m) { + return JSON.parse(m[1]); + } + } + return {}; +} + if (fs.existsSync(path.join(__dirname, '../.git'))) { test('git option', function (t) { var file = path.join(__dirname, './fixture/simple.input.js'); @@ -68,7 +80,7 @@ test('external modules option', function (t) { test('bad input', function (tt) { glob.sync(path.join(__dirname, 'fixture/bad', '*.input.js')).forEach(function (file) { tt.test(path.basename(file), function (t) { - documentation.build([file], {}, function (error, res) { + documentation.build([file], readOptionsFromFile(file), function (error, res) { t.equal(res, undefined); // make error a serializable object error = JSON.parse(JSON.stringify(error)); @@ -91,7 +103,7 @@ test('bad input', function (tt) { test('html', function (tt) { glob.sync(path.join(__dirname, 'fixture/html', '*.input.js')).forEach(function (file) { tt.test(path.basename(file), function (t) { - documentation.build([file], {}, function (err, result) { + documentation.build([file], readOptionsFromFile(file), function (err, result) { t.ifError(err); outputHtml(result, null, function (err, result) { t.ifError(err); @@ -119,7 +131,7 @@ test('html', function (tt) { test('outputs', function (ttt) { glob.sync(path.join(__dirname, 'fixture', '*.input.js')).forEach(function (file) { ttt.test(path.basename(file), function (tt) { - documentation.build([file], {}, function (err, result) { + documentation.build([file], readOptionsFromFile(file), function (err, result) { tt.ifError(err); tt.test('markdown', function (t) { @@ -174,7 +186,7 @@ test('outputs', function (ttt) { test('outputs - sync', function (ttt) { glob.sync(path.join(__dirname, 'fixture/sync', '*.input.js')).forEach(function (file) { ttt.test(path.basename(file), function (tt) { - var result = documentation.buildSync([file]); + var result = documentation.buildSync([file], readOptionsFromFile(file)); tt.test('markdown', function (t) { outputMarkdown(result, {}, function (err, result) {