11import { FULL_TEST } from "./constants.js" ;
2- import * as failedTests from "./failed-format-tests.js" ;
32import { format } from "./run-prettier.js" ;
43import consistentEndOfLine from "./utils/consistent-end-of-line.js" ;
54import createSnapshot from "./utils/create-snapshot.js" ;
@@ -9,11 +8,9 @@ import * as testBom from "./test-bom.js";
98import * as testEndOfLine from "./test-end-of-line.js" ;
109import * as testSecondFormat from "./test-second-format.js" ;
1110import * as testBytecodeCompare from "./test-bytecode-compare.js" ;
11+ import * as testAntlrFormat from "./test-antlr-format.js" ;
1212import * as testVariantCoverage from "./test-variant-coverage.js" ;
1313import { shouldThrowOnFormat } from "./utilities.js" ;
14- import getPrettier from "./get-prettier.js" ;
15- import getCreateParser from "./get-create-parser.js" ;
16- import getPlugins from "./get-plugins.js" ;
1714
1815async function runTest ( {
1916 parsers,
@@ -67,26 +64,7 @@ async function runTest({
6764 if ( ! FULL_TEST ) {
6865 return ;
6966 }
70-
71- if ( formatOptions . parser === "slang" ) {
72- const createParser = await getCreateParser ( ) ;
73- const { parser } = createParser ( code , formatOptions ) ;
74-
75- if ( ! failedTests . isAntlrMismatch ( filename , formatOptions ) ) {
76- // Compare with ANTLR's format
77- const prettier = await getPrettier ( ) ;
78- const { formatted : antlrOutput } = await prettier . formatWithCursor ( code , {
79- ...formatOptions ,
80- // Since Slang forces us to decide on a compiler version, we need to do the
81- // same for ANTLR unless it was already given as an option.
82- compiler : formatOptions . compiler || parser . languageVersion ,
83- parser : "antlr" ,
84- plugins : await getPlugins ( ) ,
85- } ) ;
86- expect ( antlrOutput ) . toEqual ( formatResult . output ) ;
87- }
88- }
89-
67+ await testAntlrFormat . run ( code , formatResult , filename , formatOptions ) ;
9068 await testVariantCoverage . run ( code , formatResult , filename , formatOptions ) ;
9169 await testSecondFormat . run ( code , formatResult , filename , formatOptions ) ;
9270 await testAstCompare . run ( code , formatResult , filename , formatOptions ) ;
0 commit comments