Skip to content

Commit 6ecdec3

Browse files
committed
Include generated code in diagnostic snapshots
1 parent 680585e commit 6ecdec3

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`forin[Array] 1`] = `"main.ts(3,9): error TSTL: Iterating over arrays with 'for ... in' is not allowed."`;
3+
exports[`forin[Array]: code 1`] = `
4+
"local ____exports = {}
5+
function ____exports.__main(self)
6+
local array = {}
7+
for key in pairs(array) do
8+
end
9+
end
10+
return ____exports"
11+
`;
12+
13+
exports[`forin[Array]: diagnostics 1`] = `"main.ts(3,9): error TSTL: Iterating over arrays with 'for ... in' is not allowed."`;

test/util.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@ export abstract class TestBuilder {
371371
{ getCurrentDirectory: () => "", getCanonicalFileName: fileName => fileName, getNewLine: () => "\n" }
372372
);
373373

374-
expect(diagnosticMessages.trim()).toMatchSnapshot();
374+
expect(this.getMainLuaCodeChunk()).toMatchSnapshot('code');
375+
expect(diagnosticMessages.trim()).toMatchSnapshot('diagnostics');
375376

376377
return this;
377378
}

0 commit comments

Comments
 (0)