Skip to content

Commit

Permalink
Fix: multi-line + fat arrow indent (fixes #2239)
Browse files Browse the repository at this point in the history
  • Loading branch information
gyandeeps committed Jul 14, 2015
1 parent 64bb039 commit dbb6a8a
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions tests/lib/rules/indent.js
Expand Up @@ -36,6 +36,38 @@ var eslintTester = new ESLintTester(eslint);
eslintTester.addRuleTest("lib/rules/indent", {

valid: [
{
code:
"[a, b, \nc].forEach((index) => {\n" +
" index;\n" +
"});\n",
options: [4],
ecmaFeatures: { arrowFunctions: true }
},
{
code:
"[a, b, \nc].forEach(function(index){\n" +
" return index;\n" +
"});\n",
options: [4],
ecmaFeatures: { arrowFunctions: true }
},
{
code:
"[a, b, c].forEach((index) => {\n" +
" index;\n" +
"});\n",
options: [4],
ecmaFeatures: { arrowFunctions: true }
},
{
code:
"[a, b, c].forEach(function(index){\n" +
" return index;\n" +
"});\n",
options: [4],
ecmaFeatures: { arrowFunctions: true }
},
{
code:
"var a = new Test({\n" +
Expand Down Expand Up @@ -509,6 +541,50 @@ eslintTester.addRuleTest("lib/rules/indent", {
[2, 4, "VariableDeclarator"],
[3, 4, "VariableDeclarator"]
])
},
{
code:
"[a, b, \nc].forEach((index) => {\n" +
" index;\n" +
"});\n",
options: [4],
ecmaFeatures: { arrowFunctions: true },
errors: expectedErrors([
[3, 4, "ExpressionStatement"]
])
},
{
code:
"[a, b, \nc].forEach(function(index){\n" +
" return index;\n" +
"});\n",
options: [4],
ecmaFeatures: { arrowFunctions: true },
errors: expectedErrors([
[3, 4, "ReturnStatement"]
])
},
{
code:
"[a, b, c].forEach((index) => {\n" +
" index;\n" +
"});\n",
options: [4],
ecmaFeatures: { arrowFunctions: true },
errors: expectedErrors([
[2, 4, "ExpressionStatement"]
])
},
{
code:
"[a, b, c].forEach(function(index){\n" +
" return index;\n" +
"});\n",
options: [4],
ecmaFeatures: { arrowFunctions: true },
errors: expectedErrors([
[2, 4, "ReturnStatement"]
])
}
]
});

0 comments on commit dbb6a8a

Please sign in to comment.