Skip to content

Commit e072bb0

Browse files
committed
Add command line parsing integration tests
1 parent 2fc099e commit e072bb0

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

test/unit/commandLineParser.spec.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,32 @@ describe("command line", () => {
9696
expect(result.options.noHeader).toBe(true);
9797
});
9898
});
99+
100+
describe("integration", () => {
101+
test.each<[string, string, tstl.CompilerOptions]>([
102+
["noHeader", "false", { noHeader: false }],
103+
["noHeader", "true", { noHeader: true }],
104+
["noHoisting", "false", { noHoisting: false }],
105+
["noHoisting", "true", { noHoisting: true }],
106+
["sourceMapTraceback", "false", { sourceMapTraceback: false }],
107+
["sourceMapTraceback", "true", { sourceMapTraceback: true }],
108+
109+
["luaLibImport", "none", { luaLibImport: tstl.LuaLibImportKind.None }],
110+
["luaLibImport", "always", { luaLibImport: tstl.LuaLibImportKind.Always }],
111+
["luaLibImport", "inline", { luaLibImport: tstl.LuaLibImportKind.Inline }],
112+
["luaLibImport", "require", { luaLibImport: tstl.LuaLibImportKind.Require }],
113+
114+
["luaTarget", "5.1", { luaTarget: tstl.LuaTarget.Lua51 }],
115+
["luaTarget", "5.2", { luaTarget: tstl.LuaTarget.Lua52 }],
116+
["luaTarget", "5.3", { luaTarget: tstl.LuaTarget.Lua53 }],
117+
["luaTarget", "jit", { luaTarget: tstl.LuaTarget.LuaJIT }],
118+
])("--%s %s", (optionName, value, expected) => {
119+
const result = tstl.parseCommandLine([`--${optionName}`, value]);
120+
121+
expect(result.errors).not.toHaveDiagnostics();
122+
expect(result.options).toEqual(expected);
123+
});
124+
});
99125
});
100126

101127
describe("tsconfig", () => {

0 commit comments

Comments
 (0)