Correctly report errors in multi-line expression strings
This commit is contained in:
@@ -306,7 +306,7 @@ jobs:
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("multi-line strings", () => {
|
describe("multi-line strings warnings", () => {
|
||||||
it("indented |", async () => {
|
it("indented |", async () => {
|
||||||
const input = `on: push
|
const input = `on: push
|
||||||
jobs:
|
jobs:
|
||||||
@@ -428,6 +428,124 @@ jobs:
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("multi-line strings errors", () => {
|
||||||
|
it("indented |", async () => {
|
||||||
|
const input = `on: push
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
first line
|
||||||
|
test \${{ fromJSON2('') }}
|
||||||
|
test2`;
|
||||||
|
const result = await validate(createDocument("wf.yaml", input));
|
||||||
|
|
||||||
|
expect(result).toEqual([
|
||||||
|
{
|
||||||
|
message: "Unrecognized function: 'fromJSON2'",
|
||||||
|
range: {
|
||||||
|
end: {
|
||||||
|
character: 35,
|
||||||
|
line: 7
|
||||||
|
},
|
||||||
|
start: {
|
||||||
|
character: 15,
|
||||||
|
line: 7
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("indented |+", async () => {
|
||||||
|
const input = `on: push
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: |+
|
||||||
|
first line
|
||||||
|
test \${{ fromJSON2('') }}
|
||||||
|
test2`;
|
||||||
|
const result = await validate(createDocument("wf.yaml", input));
|
||||||
|
|
||||||
|
expect(result).toEqual([
|
||||||
|
{
|
||||||
|
message: "Unrecognized function: 'fromJSON2'",
|
||||||
|
range: {
|
||||||
|
end: {
|
||||||
|
character: 35,
|
||||||
|
line: 7
|
||||||
|
},
|
||||||
|
start: {
|
||||||
|
character: 15,
|
||||||
|
line: 7
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("indented >", async () => {
|
||||||
|
const input = `on: push
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: >
|
||||||
|
first line
|
||||||
|
test \${{ fromJSON2('') }}
|
||||||
|
test2`;
|
||||||
|
const result = await validate(createDocument("wf.yaml", input));
|
||||||
|
|
||||||
|
expect(result).toEqual([
|
||||||
|
{
|
||||||
|
message: "Unrecognized function: 'fromJSON2'",
|
||||||
|
range: {
|
||||||
|
end: {
|
||||||
|
character: 35,
|
||||||
|
line: 7
|
||||||
|
},
|
||||||
|
start: {
|
||||||
|
character: 15,
|
||||||
|
line: 7
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("indented >+", async () => {
|
||||||
|
const input = `on: push
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: >+
|
||||||
|
first line
|
||||||
|
test \${{ fromJSON2('') }}
|
||||||
|
test2`;
|
||||||
|
const result = await validate(createDocument("wf.yaml", input));
|
||||||
|
|
||||||
|
expect(result).toEqual([
|
||||||
|
{
|
||||||
|
message: "Unrecognized function: 'fromJSON2'",
|
||||||
|
range: {
|
||||||
|
end: {
|
||||||
|
character: 35,
|
||||||
|
line: 7
|
||||||
|
},
|
||||||
|
start: {
|
||||||
|
character: 15,
|
||||||
|
line: 7
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("matrix context", () => {
|
describe("matrix context", () => {
|
||||||
it("reference within a matrix job", async () => {
|
it("reference within a matrix job", async () => {
|
||||||
const input = `
|
const input = `
|
||||||
|
|||||||
@@ -209,8 +209,6 @@ async function validateExpression(
|
|||||||
severity: DiagnosticSeverity.Warning,
|
severity: DiagnosticSeverity.Warning,
|
||||||
range: mapRange(expression.range)
|
range: mapRange(expression.range)
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user