mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Add optional "platform" parameter to helpers.applyFixes (closes #496).
This commit is contained in:
parent
4593b61ff5
commit
b9474e84a3
3 changed files with 41 additions and 11 deletions
|
@ -473,7 +473,7 @@ test("applyFix", (t) => {
|
|||
});
|
||||
|
||||
test("applyFixes", (t) => {
|
||||
t.plan(30);
|
||||
t.plan(33);
|
||||
const testCases = [
|
||||
[
|
||||
"Hello world.",
|
||||
|
@ -944,9 +944,23 @@ test("applyFixes", (t) => {
|
|||
];
|
||||
testCases.forEach((testCase) => {
|
||||
const [ input, errors, expected ] = testCase;
|
||||
// @ts-ignore
|
||||
const actual = helpers.applyFixes(input, errors);
|
||||
t.is(actual, expected, "Incorrect fix applied.");
|
||||
});
|
||||
const input = "# Heading";
|
||||
const errors = [
|
||||
{
|
||||
"lineNumber": 1,
|
||||
"fixInfo": {
|
||||
"editColumn": input.length + 1,
|
||||
"insertText": "\n"
|
||||
}
|
||||
}
|
||||
];
|
||||
t.is(helpers.applyFixes(input, errors, "darwin"), `${input}\n`);
|
||||
t.is(helpers.applyFixes(input, errors, "linux"), `${input}\n`);
|
||||
t.is(helpers.applyFixes(input, errors, "win32"), `${input}\r\n`);
|
||||
});
|
||||
|
||||
test("deepFreeze", (t) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue