Skip to content

Commit

Permalink
Chore: assertions on reporting loc in unicode-bom (refs #12334) (#1…
Browse files Browse the repository at this point in the history
…4809)

* Update: add end location to report in `unicode-bom`

* Update: report start location only
  • Loading branch information
snitin315 authored Jul 25, 2021
1 parent ed945bd commit eba0c45
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions tests/lib/rules/unicode-bom.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,52 @@ ruleTester.run("unicode-bom", rule, {
code: "var a = 123;",
output: "\uFEFFvar a = 123;",
options: ["always"],
errors: [expectedError]
errors: [{
...expectedError,
line: 1,
column: 1,
endLine: void 0,
endColumn: void 0

}]
},
{
code: " // here's a comment \nvar a = 123;",
output: "\uFEFF // here's a comment \nvar a = 123;",
options: ["always"],
errors: [expectedError]
errors: [{
...expectedError,
line: 1,
column: 1,
endLine: void 0,
endColumn: void 0

}]
},
{
code: "\uFEFF var a = 123;",
output: " var a = 123;",
errors: [unexpectedError]
errors: [{
...unexpectedError,
line: 1,
column: 1,
endLine: void 0,
endColumn: void 0

}]
},
{
code: "\uFEFF var a = 123;",
output: " var a = 123;",
options: ["never"],
errors: [unexpectedError]
errors: [{
...unexpectedError,
line: 1,
column: 1,
endLine: void 0,
endColumn: void 0

}]
}
]
});

0 comments on commit eba0c45

Please sign in to comment.