Skip to content

Commit c72aaed

Browse files
committed
preserve test intent: use strictNullChecks: false instead of casts
1 parent aa9d809 commit c72aaed

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

test/unit/error.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,15 @@ test("return nil from try", () => {
8282

8383
test("multi return from try", () => {
8484
const testBuilder = util.testFunction`
85-
function foobar(): LuaMultiReturn<[string, string]> {
85+
function foobar() {
8686
try {
8787
return $multi("foo", "bar");
8888
} catch {
8989
}
90-
return $multi("", "");
9190
}
9291
const [foo, bar] = foobar();
9392
return foo + bar;
94-
`.withLanguageExtensions();
93+
`.setOptions({ strictNullChecks: false }).withLanguageExtensions();
9594
expect(testBuilder.getMainLuaCodeChunk()).not.toMatch("unpack(foobar");
9695
testBuilder.expectToMatchJsResult();
9796
});

test/unit/language-extensions/multi.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ test("Destructuring assignment of LuaMultiReturn", () => {
3535
test("Destructuring assignment of LuaMultiReturn returning nil", () => {
3636
util.testModule`
3737
function multiReturn(): LuaMultiReturn<[number, number, number]> {
38-
return undefined as any;
38+
return;
3939
}
4040
4141
const [a, ...b] = multiReturn();
4242
export {a, b};
4343
`
44+
.setOptions({ strictNullChecks: false })
4445
.withLanguageExtensions()
4546
.expectToEqual({ a: undefined, b: [] });
4647
});
@@ -272,9 +273,10 @@ test("return $multi from try", () => {
272273
} catch {
273274
}
274275
}
275-
const [_, a] = multiTest()!;
276+
const [_, a] = multiTest();
276277
return a;
277278
`
279+
.setOptions({ strictNullChecks: false })
278280
.withLanguageExtensions()
279281
.expectToEqual(2);
280282
});
@@ -304,9 +306,10 @@ test("return LuaMultiReturn from try", () => {
304306
} catch {
305307
}
306308
}
307-
const [_, a] = multiTest()!;
309+
const [_, a] = multiTest();
308310
return a;
309311
`
312+
.setOptions({ strictNullChecks: false })
310313
.withLanguageExtensions()
311314
.expectToEqual(2);
312315
});

test/unit/switch.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,10 @@ test("switch using variable re-declared in cases", () => {
138138
switch (foo) {
139139
case 0:
140140
let foo = true;
141-
return foo;
142141
case 1:
143-
return false;
142+
return foo;
144143
}
145-
`.expectToMatchJsResult();
144+
`.setOptions({ strictNullChecks: false }).expectToMatchJsResult();
146145
});
147146

148147
test.each([0, 1, 2])("switch with block statement scope (%p)", inp => {

0 commit comments

Comments
 (0)