From c0a7ebf51b56130668c0f3dce815a10d0f37eeb0 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 14 Sep 2015 14:26:21 -0400 Subject: [PATCH] fix attachComment typo, add comment tests --- .../babel-eslint-parser/test/babel-eslint.js | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 3ef824046c..216717312c 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -63,7 +63,7 @@ function parseAndAssertSame(code) { loc: true, range: true, comment: true, - attachComments: true + attachComment: true }); var acornAST = babelEslint.parse(code); try { @@ -302,4 +302,29 @@ describe("acorn-to-esprima", function () { it("empty", function () { parseAndAssertSame(""); }); + + it("jsdoc", function () { + parseAndAssertSame([ + "/**", + "* @param {object} options", + "* @return {number}", + "*/", + "const test = function({ a, b, c }) {", + "return a + b + c;", + "};", + "module.exports = test;" + ].join("\n")); + }) + + it("empty block with comment", function () { + parseAndAssertSame([ + "function a () {", + "try {", + "b();", + "} catch (e) {", + "// asdf", + "}", + "}" + ].join("\n")); + }) });