@@ -3,16 +3,19 @@ import getPrettier from "./get-prettier.js";
33import getCreateParser from "./get-create-parser.js" ;
44import getPlugins from "./get-plugins.js" ;
55
6- async function testAntlrFormat ( source , formatResult , filename , formatOptions ) {
6+ async function testAntlrFormat ( testCase ) {
7+ const { code, filepath, formatOptions } = testCase ;
8+ const formatResult = await testCase . runFormat ( ) ;
9+
710 if (
811 formatOptions . parser === "slang" &&
9- ! failedTests . isAntlrMismatch ( filename , formatOptions )
12+ ! failedTests . isAntlrMismatch ( filepath , formatOptions )
1013 ) {
1114 // Compare with ANTLR's format
1215 const createParser = await getCreateParser ( ) ;
13- const { parser } = createParser ( source , formatOptions ) ;
16+ const { parser } = createParser ( code , formatOptions ) ;
1417 const prettier = await getPrettier ( ) ;
15- const { formatted : antlrOutput } = await prettier . formatWithCursor ( source , {
18+ const { formatted : antlrOutput } = await prettier . formatWithCursor ( code , {
1619 ...formatOptions ,
1720 // Since Slang forces us to decide on a compiler version, we need to do the
1821 // same for ANTLR unless it was already given as an option.
0 commit comments