Skip to content

Commit

Permalink
refactor: code prettier pass.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeshecdom committed Jan 28, 2025
1 parent 6c47f3d commit c94feda
Showing 1 changed file with 28 additions and 32 deletions.
60 changes: 28 additions & 32 deletions src/optimizer/test/short-circuit-inits.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,36 @@ import { loadCases } from "../../utils/loadCases";

describe("short-circuit-initialization", () => {
for (const r of loadCases(__dirname + "/success/")) {
it(`${r.name} should pass boolean short-circuiting during initialization`,
() => {
const Ast = getAstFactory();
let ctx = openContext(
new CompilerContext(),
[{ code: r.code, path: "<unknown>", origin: "user" }],
[],
getParser(Ast, defaultParser),
);
ctx = featureEnable(ctx, "external");
it(`${r.name} should pass boolean short-circuiting during initialization`, () => {
const Ast = getAstFactory();
let ctx = openContext(
new CompilerContext(),
[{ code: r.code, path: "<unknown>", origin: "user" }],
[],
getParser(Ast, defaultParser),
);
ctx = featureEnable(ctx, "external");
ctx = resolveDescriptors(ctx, Ast);
ctx = resolveStatements(ctx, Ast);
ctx = resolveSignatures(ctx, Ast);
expect(getAllExpressionTypes(ctx)).toMatchSnapshot();
});
}
for (const r of loadCases(__dirname + "/failed/")) {
it(`${r.name} should fail boolean short-circuiting during initialization`, () => {
const Ast = getAstFactory();
let ctx = openContext(
new CompilerContext(),
[{ code: r.code, path: "<unknown>", origin: "user" }],
[],
getParser(Ast, defaultParser),
);
ctx = featureEnable(ctx, "external");
expect(() => {
ctx = resolveDescriptors(ctx, Ast);
ctx = resolveStatements(ctx, Ast);
ctx = resolveSignatures(ctx, Ast);
expect(getAllExpressionTypes(ctx)).toMatchSnapshot();
},
);
}
for (const r of loadCases(__dirname + "/failed/")) {
it(`${r.name} should fail boolean short-circuiting during initialization`,
() => {
const Ast = getAstFactory();
let ctx = openContext(
new CompilerContext(),
[{ code: r.code, path: "<unknown>", origin: "user" }],
[],
getParser(Ast, defaultParser),
);
ctx = featureEnable(ctx, "external");
expect(() => {
ctx = resolveDescriptors(ctx, Ast);
ctx = resolveStatements(ctx, Ast);
ctx = resolveSignatures(ctx, Ast);
}).toThrowErrorMatchingSnapshot();
},
);
}).toThrowErrorMatchingSnapshot();
});
}
});

0 comments on commit c94feda

Please sign in to comment.