From 3af329dea52e45e163f0112fbafda42eda0d1494 Mon Sep 17 00:00:00 2001 From: Klaus Date: Fri, 13 Mar 2026 12:55:34 -0300 Subject: [PATCH 1/5] refactoring run tests to describe --- tests/config/run-test.js | 98 ++++++++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 24 deletions(-) diff --git a/tests/config/run-test.js b/tests/config/run-test.js index 163cfca92..0a333cdfe 100644 --- a/tests/config/run-test.js +++ b/tests/config/run-test.js @@ -22,33 +22,83 @@ async function testFixture(fixture) { describe(title, () => { const testCases = parsers.map((parser) => getTestCase(fixture, parser)); - for (const testCase of testCases) { - const testTitle = - testCase.expectFail || testCase.formatOptions.parser !== testCase.parser - ? `[${testCase.parser}] format` - : "format"; + const testCaseForSnapshot = testCases.find( + (testCase) => + !testCase.expectFail && typeof testCase.expectedOutput !== "string", + ); - test(testTitle, async () => { - await testFormat.run(testCase); + const hasMultipleParsers = testCases.length > 1; - if (!FULL_TEST) { - return; + for (const functionality of [ + { + name(testCase) { + let name = "format"; + // Avoid parser display in snapshot + if (testCaseForSnapshot !== testCase && hasMultipleParsers) { + name += `[${testCase.parser}]`; + } + return name; + }, + test: { + run: (testCase) => testFormat.run(testCase, testCaseForSnapshot), + }, + }, + { + name: "ast compare", + test: { run: testAstCompare.run }, + skip: () => !FULL_TEST, + }, + // The following cases only need run on main parser + { + name: "second format", + test: { run: testSecondFormat.run }, + skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot, + }, + { + name: "end of line (CRLF)", + test: { run: (testCase) => testEndOfLine.run(testCase, "\r\n") }, + skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot, + }, + { + name: "end of line (CR)", + test: { run: (testCase) => testEndOfLine.run(testCase, "\r") }, + skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot, + }, + { + name: "BOM", + test: { run: testBom.run }, + skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot, + }, + { + name: "ANTLR format", + test: { run: testAntlrFormat.run }, + skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot, + }, + { + name: "bytecode comparison", + test: { run: testBytecodeCompare.run }, + skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot, + }, + { + name: "variant coverage", + test: { run: testVariantCoverage.run }, + skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot, + }, + ]) { + for (const testCase of testCases) { + if (functionality.skip?.(testCase)) { + continue; } - await Promise.all( - [ - testAntlrFormat.run, - testVariantCoverage.run, - testSecondFormat.run, - testAstCompare.run, - testBom.run, - testBytecodeCompare.run, - ] - .map((test) => test(testCase)) - .join( - ["\r\n", "\r"].map((eol) => testEndOfLine.run(testCase, eol)), - ), - ); - }); + let { name } = functionality; + if (typeof name === "function") { + name = name(testCase); + } else if (hasMultipleParsers) { + name += ` [${testCase.parser}]`; + } + test(name, async () => { + await functionality.test.run(testCase); + }); + } } }); } From 7f2bc554bbe235a9a8d22591452bec683be99753 Mon Sep 17 00:00:00 2001 From: Klaus Date: Fri, 13 Mar 2026 12:56:57 -0300 Subject: [PATCH 2/5] TEST_STANDALONE should be a constant --- tests/config/constants.js | 2 +- tests/config/get-create-parser.js | 4 +++- tests/config/get-plugins.js | 5 +++-- tests/config/get-prettier.js | 6 +++--- tests/config/get-variant-coverage.js | 4 +++- tests/config/run-test.js | 16 +++++++++++++--- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/tests/config/constants.js b/tests/config/constants.js index aa73184cd..06dee4b13 100644 --- a/tests/config/constants.js +++ b/tests/config/constants.js @@ -10,7 +10,7 @@ export const FORMAT_TEST_DIRECTORY = normalizeDirectory( path.join(__dirname, "../format/"), ); -export const { FULL_TEST } = process.env; +export const { FULL_TEST, TEST_STANDALONE } = process.env; export const BOM = "\uFEFF"; export const CURSOR_PLACEHOLDER = "<|>"; diff --git a/tests/config/get-create-parser.js b/tests/config/get-create-parser.js index 5859a59db..0fbd4a1a6 100644 --- a/tests/config/get-create-parser.js +++ b/tests/config/get-create-parser.js @@ -1,5 +1,7 @@ +import { TEST_STANDALONE } from "./constants.js"; + function getCreateParserInternal() { - const entry = process.env.TEST_STANDALONE + const entry = TEST_STANDALONE ? "../../dist/create-parser.js" : "../../src/slang-utils/create-parser.js"; diff --git a/tests/config/get-plugins.js b/tests/config/get-plugins.js index 6b65ea733..19c736b1b 100644 --- a/tests/config/get-plugins.js +++ b/tests/config/get-plugins.js @@ -1,11 +1,12 @@ import path from "node:path"; import createEsmUtils from "esm-utils"; import getPrettier from "./get-prettier.js"; +import { TEST_STANDALONE } from "./constants.js"; const { __dirname } = createEsmUtils(import.meta); // populate the root object for the standalone in node -if (process.env.TEST_STANDALONE) { +if (TEST_STANDALONE) { const root = typeof globalThis !== "undefined" ? globalThis @@ -19,7 +20,7 @@ if (process.env.TEST_STANDALONE) { function getPluginsInternal() { return Promise.all( - process.env.TEST_STANDALONE + TEST_STANDALONE ? [ import("prettier/plugins/babel"), import("prettier/plugins/estree"), diff --git a/tests/config/get-prettier.js b/tests/config/get-prettier.js index 261595ce3..4ace6cc31 100644 --- a/tests/config/get-prettier.js +++ b/tests/config/get-prettier.js @@ -1,7 +1,7 @@ +import { TEST_STANDALONE } from "./constants.js"; + function getPrettierInternal() { - const entry = process.env.TEST_STANDALONE - ? "prettier/standalone" - : "prettier"; + const entry = TEST_STANDALONE ? "prettier/standalone" : "prettier"; return import(entry).then((module) => module.default); } diff --git a/tests/config/get-variant-coverage.js b/tests/config/get-variant-coverage.js index 0d2bc62b1..10412f640 100644 --- a/tests/config/get-variant-coverage.js +++ b/tests/config/get-variant-coverage.js @@ -1,5 +1,7 @@ +import { TEST_STANDALONE } from "./constants.js"; + function getVariantCoverageInternal() { - const entry = process.env.TEST_STANDALONE + const entry = TEST_STANDALONE ? "../../dist/variant-coverage.js" : "../../variant-coverage/index.js"; diff --git a/tests/config/run-test.js b/tests/config/run-test.js index 0a333cdfe..86fc47d0f 100644 --- a/tests/config/run-test.js +++ b/tests/config/run-test.js @@ -69,20 +69,30 @@ async function testFixture(fixture) { test: { run: testBom.run }, skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot, }, + // The following cases only need run if the parser is Slang { name: "ANTLR format", test: { run: testAntlrFormat.run }, - skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot, + skip: (testCase) => + !FULL_TEST || + testCase !== testCaseForSnapshot || + testCase.parser !== "slang", }, { name: "bytecode comparison", test: { run: testBytecodeCompare.run }, - skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot, + skip: (testCase) => + !FULL_TEST || + testCase !== testCaseForSnapshot || + testCase.parser !== "slang", }, { name: "variant coverage", test: { run: testVariantCoverage.run }, - skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot, + skip: (testCase) => + !FULL_TEST || + testCase !== testCaseForSnapshot || + testCase.parser !== "slang", }, ]) { for (const testCase of testCases) { From b505e9c3d0104cdf296d20f966383d8e4bbdfde5 Mon Sep 17 00:00:00 2001 From: Klaus Date: Fri, 13 Mar 2026 16:10:08 -0300 Subject: [PATCH 3/5] now that all the files are as close as possible to prettier's current test configuration we update to prettier's version --- tests/config/{utils => }/compile-contract.js | 0 .../{utils => }/consistent-end-of-line.js | 0 tests/config/{utils => }/create-snapshot.js | 2 +- tests/config/format-test-setup.js | 2 +- tests/config/get-fixtures.js | 16 +++- tests/config/replace-placeholders.js | 4 + tests/config/run-format-test.js | 30 +++++++- tests/config/run-prettier.js | 10 +-- tests/config/run-test.js | 53 +++++++++---- .../stringify-options-for-title.js | 0 tests/config/test-antlr-format.js | 34 ++++++--- tests/config/test-ast-compare.js | 47 +++++++++--- tests/config/test-bom.js | 41 +++++++--- tests/config/test-bytecode-compare.js | 33 ++++++-- tests/config/test-end-of-line.js | 57 +++++++++----- tests/config/test-format.js | 76 ++++++++++--------- tests/config/test-second-format.js | 68 +++++++++++++---- tests/config/test-variant-coverage.js | 26 +++++-- tests/config/utilities.js | 2 +- .../{utils => }/visualize-end-of-line.js | 0 tests/config/{utils => }/visualize-range.js | 0 21 files changed, 365 insertions(+), 136 deletions(-) rename tests/config/{utils => }/compile-contract.js (100%) rename tests/config/{utils => }/consistent-end-of-line.js (100%) rename tests/config/{utils => }/create-snapshot.js (98%) rename tests/config/{utils => }/stringify-options-for-title.js (100%) rename tests/config/{utils => }/visualize-end-of-line.js (100%) rename tests/config/{utils => }/visualize-range.js (100%) diff --git a/tests/config/utils/compile-contract.js b/tests/config/compile-contract.js similarity index 100% rename from tests/config/utils/compile-contract.js rename to tests/config/compile-contract.js diff --git a/tests/config/utils/consistent-end-of-line.js b/tests/config/consistent-end-of-line.js similarity index 100% rename from tests/config/utils/consistent-end-of-line.js rename to tests/config/consistent-end-of-line.js diff --git a/tests/config/utils/create-snapshot.js b/tests/config/create-snapshot.js similarity index 98% rename from tests/config/utils/create-snapshot.js rename to tests/config/create-snapshot.js index 510a30846..e51293aef 100644 --- a/tests/config/utils/create-snapshot.js +++ b/tests/config/create-snapshot.js @@ -1,5 +1,5 @@ import { wrap as raw } from "jest-snapshot-serializer-raw"; -import { CURSOR_PLACEHOLDER } from "../constants.js"; +import { CURSOR_PLACEHOLDER } from "./constants.js"; import visualizeEndOfLine from "./visualize-end-of-line.js"; import visualizeRange from "./visualize-range.js"; diff --git a/tests/config/format-test-setup.js b/tests/config/format-test-setup.js index 98222ffc2..df8e959a2 100644 --- a/tests/config/format-test-setup.js +++ b/tests/config/format-test-setup.js @@ -1,3 +1,3 @@ -import runFormatTest from "./run-format-test.js"; +import { runFormatTest } from "./run-format-test.js"; globalThis.runFormatTest = runFormatTest; diff --git a/tests/config/get-fixtures.js b/tests/config/get-fixtures.js index 405632b7f..170285057 100644 --- a/tests/config/get-fixtures.js +++ b/tests/config/get-fixtures.js @@ -1,13 +1,24 @@ import fs from "node:fs"; import path from "node:path"; import { FORMAT_SCRIPT_FILENAME } from "./constants.js"; -import visualizeEndOfLine from "./utils/visualize-end-of-line.js"; +import visualizeEndOfLine from "./visualize-end-of-line.js"; +/** +@import {Context} from "./run-format-test.js" +@typedef {Exclude["next"]>["value"], void>} Fixture +*/ + +/** +@param {Context} context +*/ function* getFixtures(context) { yield* getFiles(context); yield* getSnippets(context); } +/** +@param {Context} context +*/ function* getFiles(context) { const { dirname } = context; for (const file of fs.readdirSync(dirname, { withFileTypes: true })) { @@ -36,6 +47,9 @@ function* getFiles(context) { } } +/** +@param {Context} context +*/ function* getSnippets(context) { for (const [index, snippet] of context.snippets.entries()) { const testCase = diff --git a/tests/config/replace-placeholders.js b/tests/config/replace-placeholders.js index 39c58576e..5be8cda64 100644 --- a/tests/config/replace-placeholders.js +++ b/tests/config/replace-placeholders.js @@ -19,6 +19,10 @@ const indexProperties = [ }, ]; +/** +@param {string} originalText +@param {any} originalOptions +*/ function replacePlaceholders(originalText, originalOptions) { const indexes = indexProperties .map(({ property, placeholder }) => { diff --git a/tests/config/run-format-test.js b/tests/config/run-format-test.js index 7871e0501..b8b76cad4 100644 --- a/tests/config/run-format-test.js +++ b/tests/config/run-format-test.js @@ -3,12 +3,36 @@ import url from "node:url"; import { FORMAT_SCRIPT_FILENAME } from "./constants.js"; import { getFixtures } from "./get-fixtures.js"; import { testFixture } from "./run-test.js"; -import { stringifyOptionsForTitle } from "./utils/stringify-options-for-title.js"; +import { stringifyOptionsForTitle } from "./stringify-options-for-title.js"; import { isErrorTest as isErrorTestDirectory, normalizeDirectory, } from "./utilities.js"; +/** +@typedef { + | string + | { code: string; name?: string; filename?: string; output?: string } +} Snippet +@typedef {{ + dirname: string, + stringifiedOptions: string, + parsers: string[], + options: any, + explicitParsers: string[], + rawOptions: any, + snippets: Snippet[], +}} Context +*/ + +/** +@param { + | ImportMeta + | { importMeta: ImportMeta, snippets?: Snippet[] } +} rawFixtures +@param {string[]} explicitParsers +@param {any} rawOptions +*/ function runFormatTest(rawFixtures, explicitParsers, rawOptions) { const { importMeta, snippets = [] } = rawFixtures.importMeta ? rawFixtures @@ -36,6 +60,8 @@ function runFormatTest(rawFixtures, explicitParsers, rawOptions) { options = { errors: true, ...options }; } + // Make sure tests are in correct location + const context = { dirname, stringifiedOptions: stringifyOptionsForTitle(rawOptions), @@ -51,4 +77,4 @@ function runFormatTest(rawFixtures, explicitParsers, rawOptions) { } } -export default runFormatTest; +export { runFormatTest }; diff --git a/tests/config/run-prettier.js b/tests/config/run-prettier.js index 7f058e969..b8bc5492e 100644 --- a/tests/config/run-prettier.js +++ b/tests/config/run-prettier.js @@ -1,12 +1,10 @@ import getPrettier from "./get-prettier.js"; import getPlugins from "./get-plugins.js"; import { CURSOR_PLACEHOLDER } from "./constants.js"; -import visualizeEndOfLine from "./utils/visualize-end-of-line.js"; -import { replacePlaceholders } from "./replace-placeholders.js"; +import visualizeEndOfLine from "./visualize-end-of-line.js"; async function parse(input, options) { const prettier = await getPrettier(); - const { ast } = await prettier.__debug.parse( input, await loadPlugins(options), @@ -15,11 +13,7 @@ async function parse(input, options) { return ast; } -async function format(originalText, originalOptions) { - const { text: input, options } = replacePlaceholders( - originalText, - originalOptions, - ); +async function format(input, options) { const inputWithCursor = insertCursor(input, options.cursorOffset); const prettier = await getPrettier(); diff --git a/tests/config/run-test.js b/tests/config/run-test.js index 86fc47d0f..05287a920 100644 --- a/tests/config/run-test.js +++ b/tests/config/run-test.js @@ -11,7 +11,15 @@ import * as testAntlrFormat from "./test-antlr-format.js"; import * as testVariantCoverage from "./test-variant-coverage.js"; import { shouldThrowOnFormat } from "./utilities.js"; -async function testFixture(fixture) { +/** +@import {Fixture} from "./get-fixtures.js" +@typedef {ReturnType} TestCase +*/ + +/** +@param {Fixture} fixture +*/ +function testFixture(fixture) { const { name, context } = fixture; const { stringifiedOptions, parsers } = context; @@ -40,39 +48,46 @@ async function testFixture(fixture) { return name; }, test: { - run: (testCase) => testFormat.run(testCase, testCaseForSnapshot), + run: (testCase, name) => + testFormat.run(testCase, name, testCaseForSnapshot), }, }, { name: "ast compare", - test: { run: testAstCompare.run }, + test: { run: testAstCompare.run, skip: testAstCompare.skip }, skip: () => !FULL_TEST, }, // The following cases only need run on main parser { name: "second format", - test: { run: testSecondFormat.run }, + test: { run: testSecondFormat.run, skip: testSecondFormat.skip }, skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot, }, { name: "end of line (CRLF)", - test: { run: (testCase) => testEndOfLine.run(testCase, "\r\n") }, + test: { + run: (testCase, name) => testEndOfLine.run(testCase, name, "\r\n"), + skip: testEndOfLine.skip, + }, skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot, }, { name: "end of line (CR)", - test: { run: (testCase) => testEndOfLine.run(testCase, "\r") }, + test: { + run: (testCase, name) => testEndOfLine.run(testCase, name, "\r"), + skip: testEndOfLine.skip, + }, skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot, }, { name: "BOM", - test: { run: testBom.run }, + test: { run: testBom.run, skip: testBom.skip }, skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot, }, // The following cases only need run if the parser is Slang { name: "ANTLR format", - test: { run: testAntlrFormat.run }, + test: { run: testAntlrFormat.run, skip: testAntlrFormat.skip }, skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot || @@ -80,7 +95,7 @@ async function testFixture(fixture) { }, { name: "bytecode comparison", - test: { run: testBytecodeCompare.run }, + test: { run: testBytecodeCompare.run, skip: testBytecodeCompare.skip }, skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot || @@ -88,7 +103,7 @@ async function testFixture(fixture) { }, { name: "variant coverage", - test: { run: testVariantCoverage.run }, + test: { run: testVariantCoverage.run, skip: testVariantCoverage.skip }, skip: (testCase) => !FULL_TEST || testCase !== testCaseForSnapshot || @@ -96,23 +111,30 @@ async function testFixture(fixture) { }, ]) { for (const testCase of testCases) { - if (functionality.skip?.(testCase)) { + if ( + functionality.skip?.(testCase) || + functionality.test.skip?.(testCase) + ) { continue; } + let { name } = functionality; if (typeof name === "function") { name = name(testCase); } else if (hasMultipleParsers) { name += ` [${testCase.parser}]`; } - test(name, async () => { - await functionality.test.run(testCase); - }); + + functionality.test.run(testCase, name); } } }); } +/** +@param {Fixture} fixture +@param {string} parser +*/ function getTestCase(fixture, parser) { const { code: originalText, context, filepath } = fixture; @@ -120,14 +142,15 @@ function getTestCase(fixture, parser) { originalText, { printWidth: 80, - ...context.options, filepath, + ...context.options, parser, }, ); const expectFail = shouldThrowOnFormat(fixture, formatOptions); + /** @type {ReturnType | undefined} */ let promise; return { diff --git a/tests/config/utils/stringify-options-for-title.js b/tests/config/stringify-options-for-title.js similarity index 100% rename from tests/config/utils/stringify-options-for-title.js rename to tests/config/stringify-options-for-title.js diff --git a/tests/config/test-antlr-format.js b/tests/config/test-antlr-format.js index 75227a464..a55df8d43 100644 --- a/tests/config/test-antlr-format.js +++ b/tests/config/test-antlr-format.js @@ -3,14 +3,19 @@ import getPrettier from "./get-prettier.js"; import getCreateParser from "./get-create-parser.js"; import getPlugins from "./get-plugins.js"; -async function testAntlrFormat(testCase) { - const { code, filepath, formatOptions } = testCase; - const formatResult = await testCase.runFormat(); +/** +@import {TestCase} from "./run-test.js" +*/ + +/** +@param {TestCase} testCase +@param {string} name +*/ +function testAntlrFormat(testCase, name) { + test(name, async () => { + const { code, formatOptions } = testCase; + const formatResult = await testCase.runFormat(); - if ( - formatOptions.parser === "slang" && - !failedTests.isAntlrMismatch(filepath, formatOptions) - ) { // Compare with ANTLR's format const createParser = await getCreateParser(); const { parser } = createParser(code, formatOptions); @@ -24,7 +29,18 @@ async function testAntlrFormat(testCase) { plugins: await getPlugins(), }); expect(antlrOutput).toEqual(formatResult.output); - } + }); +} + +/** +@param {TestCase} testCase +@return {boolean} +*/ +function shouldSkip(testCase) { + return ( + testCase.expectFail || + failedTests.isAntlrMismatch(testCase.filepath, testCase.formatOptions) + ); } -export { testAntlrFormat as run }; +export { testAntlrFormat as run, shouldSkip as skip }; diff --git a/tests/config/test-ast-compare.js b/tests/config/test-ast-compare.js index 80d78f0a9..9fe3b758c 100644 --- a/tests/config/test-ast-compare.js +++ b/tests/config/test-ast-compare.js @@ -1,24 +1,51 @@ import * as failedTests from "./failed-format-tests.js"; import { parse } from "./run-prettier.js"; -async function testAstCompare(testCase) { - const { code, filepath, formatOptions } = testCase; - const formatResult = await testCase.runFormat(); +/** +@import {TestCase} from "./run-test.js" +*/ + +/** +@param {TestCase} testCase +@param {string} name +*/ +function testAstCompare(testCase, name) { + test(name, async () => { + const formatResult = await testCase.runFormat(); + + if (!formatResult.changed) { + return; + } - const isAstUnstableTest = failedTests.isAstUnstable(filepath, formatOptions); - // Some parsers skip parsing empty files - if (formatResult.changed && code.trim()) { const [originalAst, formattedAst] = await Promise.all( [formatResult.input, formatResult.output].map((code) => parse(code, formatResult.options), ), ); + const { filepath, formatOptions } = testCase; + const isAstUnstableTest = failedTests.isAstUnstable( + filepath, + formatOptions, + ); + if (isAstUnstableTest) { - expect(formattedAst).not.toEqual(originalAst); + expect(formattedAst).not.toStrictEqual(originalAst); } else { - expect(formattedAst).toEqual(originalAst); + expect(formattedAst).toStrictEqual(originalAst); } - } + }); +} + +/** +@param {TestCase} testCase +@return {boolean} +*/ +function shouldSkip(testCase) { + return ( + testCase.expectFail || + // Some parsers skip parsing empty files + testCase.isEmpty + ); } -export { testAstCompare as run }; +export { testAstCompare as run, shouldSkip as skip }; diff --git a/tests/config/test-bom.js b/tests/config/test-bom.js index 585457c87..96adda32e 100644 --- a/tests/config/test-bom.js +++ b/tests/config/test-bom.js @@ -1,18 +1,39 @@ import { BOM } from "./constants.js"; +import { replacePlaceholders } from "./replace-placeholders.js"; import { format } from "./run-prettier.js"; -async function testBom(testCase) { - const { code, formatOptions } = testCase; - const formatResult = await testCase.runFormat(); +/** +@import {TestCase} from "./run-test.js" +*/ - if (code.charAt(0) !== BOM) { - const { eolVisualizedOutput: output } = await format( - BOM + code, - formatOptions, +/** +@param {TestCase} testCase +@param {string} name +*/ + +function testBom(testCase, name) { + test(name, async () => { + const { text, options } = replacePlaceholders( + BOM + testCase.originalText, + testCase.formatOptions, ); + + const [formatResult, { eolVisualizedOutput: output }] = await Promise.all([ + testCase.runFormat(), + format(text, options), + ]); + const expected = BOM + formatResult.eolVisualizedOutput; - expect(output).toEqual(expected); - } + expect(output).toBe(expected); + }); +} + +/** +@param {TestCase} testCase +@return {boolean} +*/ +function shouldSkip(testCase) { + return testCase.expectFail || testCase.code.charAt(0) === BOM; } -export { testBom as run }; +export { testBom as run, shouldSkip as skip }; diff --git a/tests/config/test-bytecode-compare.js b/tests/config/test-bytecode-compare.js index e41f82e49..6a8ae3d50 100644 --- a/tests/config/test-bytecode-compare.js +++ b/tests/config/test-bytecode-compare.js @@ -1,16 +1,24 @@ import path from "node:path"; import createEsmUtils from "esm-utils"; -import compileContract from "./utils/compile-contract.js"; +import compileContract from "./compile-contract.js"; -async function testBytecodeCompare(testCase) { - const { filepath, formatOptions } = testCase; - const formatResult = await testCase.runFormat(); +/** +@import {TestCase} from "./run-test.js" +*/ + +/** +@param {TestCase} testCase +@param {string} name +*/ +function testBytecodeCompare(testCase, name) { + test(name, async () => { + const { filepath } = testCase; + const formatResult = await testCase.runFormat(); - if (shouldCompareBytecode(filepath, formatOptions)) { const output = compileContract(filepath, formatResult.output); const expected = compileContract(filepath, formatResult.input); expect(output).toEqual(expected); - } + }); } const { __dirname } = createEsmUtils(import.meta); @@ -49,4 +57,15 @@ const shouldCompareBytecode = (filepath, options) => { return testFunction(options); }; -export { testBytecodeCompare as run }; +/** +@param {TestCase} testCase +@return {boolean} +*/ +function shouldSkip(testCase) { + return ( + testCase.expectFail || + !shouldCompareBytecode(testCase.filepath, testCase.formatOptions) + ); +} + +export { testBytecodeCompare as run, shouldSkip as skip }; diff --git a/tests/config/test-end-of-line.js b/tests/config/test-end-of-line.js index 6128ea078..ab9511fd4 100644 --- a/tests/config/test-end-of-line.js +++ b/tests/config/test-end-of-line.js @@ -1,36 +1,56 @@ +import { replacePlaceholders } from "./replace-placeholders.js"; import { format } from "./run-prettier.js"; -import visualizeEndOfLine from "./utils/visualize-end-of-line.js"; +import visualizeEndOfLine from "./visualize-end-of-line.js"; -async function testEndOfLine(testCase, eol) { - const { code, formatOptions } = testCase; - const formatResult = await testCase.runFormat(); +/** +@import {TestCase} from "./run-test.js" +*/ - if (!shouldSkipEolTest(code, formatResult.options)) { - const { eolVisualizedOutput: output } = await format( - code.replace(/\n/gu, eol), - formatOptions, +/** +@param {TestCase} testCase +@param {string} name +@param {"\r\n" | "\r"} eol +*/ +function testEndOfLine(testCase, name, eol) { + test(name, async () => { + const { text, options } = replacePlaceholders( + testCase.originalText.replace(/\n/g, eol), + testCase.formatOptions, ); - // Only if `endOfLine: "auto"` the result will be different + + const [formatResult, { eolVisualizedOutput: output }] = await Promise.all([ + testCase.runFormat(), + format(text, options), + ]); + const expected = - formatOptions.endOfLine === "auto" + options.endOfLine === "auto" ? visualizeEndOfLine( // All `code` use `LF`, so the `eol` of result is always `LF` - formatResult.outputWithCursor.replace(/\n/gu, eol), + formatResult.outputWithCursor.replace(/\n/g, eol), ) : formatResult.eolVisualizedOutput; - expect(output).toEqual(expected); - } + + expect(output).toBe(expected); + }); } -function shouldSkipEolTest(source, options) { - if (source.includes("\r")) { +/** +@param {TestCase} testCase +@return {boolean} +*/ +function shouldSkip(testCase) { + if (testCase.expectFail || testCase.isEmpty || testCase.code.includes("\r")) { return true; } - const { requirePragma, rangeStart, rangeEnd } = options; - if (requirePragma) { + + // They may prevent code been formatted + const { requirePragma, checkIgnorePragma } = testCase.formatOptions; + if (requirePragma || checkIgnorePragma) { return true; } + const { rangeStart, rangeEnd } = testCase.formatOptions; if ( typeof rangeStart === "number" && typeof rangeEnd === "number" && @@ -38,7 +58,8 @@ function shouldSkipEolTest(source, options) { ) { return true; } + return false; } -export { testEndOfLine as run }; +export { testEndOfLine as run, shouldSkip as skip }; diff --git a/tests/config/test-format.js b/tests/config/test-format.js index 75eadef3e..59d974c60 100644 --- a/tests/config/test-format.js +++ b/tests/config/test-format.js @@ -1,45 +1,51 @@ -import consistentEndOfLine from "./utils/consistent-end-of-line.js"; -import createSnapshot from "./utils/create-snapshot.js"; -import visualizeEndOfLine from "./utils/visualize-end-of-line.js"; +import consistentEndOfLine from "./consistent-end-of-line.js"; +import createSnapshot from "./create-snapshot.js"; +import visualizeEndOfLine from "./visualize-end-of-line.js"; + +/** +@import {TestCase} from "./run-test.js" +*/ + +/** +@param {TestCase} testCase +@param {string} name +@param {TestCase} testCaseForSnapshot +*/ +function testFormat(testCase, name, testCaseForSnapshot) { + test(name, async () => { + if (testCase.expectFail) { + await expect(testCase.runFormat).rejects.toThrowErrorMatchingSnapshot(); + return; + } -async function testFormat(testCase) { - const { code, parser, expectedOutput, formatOptions } = testCase; - const formatResult = await testCase.runFormat(); + const formatResult = await testCase.runFormat(); + expect(formatResult).toBeDefined(); - // Verify parsers or error tests - if (formatOptions.parser !== parser) { - const runFormat = () => format(code, formatOptions); + // Make sure output has consistent EOL + expect(formatResult.eolVisualizedOutput).toBe( + visualizeEndOfLine(consistentEndOfLine(formatResult.outputWithCursor)), + ); - if (shouldThrowOnFormat(name, formatOptions)) { - await expect(runFormat()).rejects.toThrowErrorMatchingSnapshot(); + if (typeof testCase.expectedOutput === "string") { + expect(formatResult.eolVisualizedOutput).toBe(testCase.expectedOutput); return; } - // Verify parsers format result should be the same as main parser - output = formatResult.outputWithCursor; - formatResult = await runFormat(); - } - - // Make sure output has consistent EOL - expect(formatResult.eolVisualizedOutput).toEqual( - visualizeEndOfLine(consistentEndOfLine(formatResult.outputWithCursor)), - ); + if (testCase !== testCaseForSnapshot) { + const { eolVisualizedOutput } = await testCaseForSnapshot.runFormat(); + expect(formatResult.eolVisualizedOutput).toStrictEqual( + eolVisualizedOutput, + ); + return; + } - // The result is assert to equals to `expectedOutput` - if (typeof expectedOutput === "string") { - expect(formatResult.eolVisualizedOutput).toEqual( - visualizeEndOfLine(expectedOutput), - ); - return; - } - - // All parsers have the same result, only snapshot the result from main parser - expect( - createSnapshot(formatResult, { - parsers: testCase.context.parsers, - formatOptions, - }), - ).toMatchSnapshot(); + expect( + createSnapshot(formatResult, { + parsers: testCase.context.explicitParsers, + formatOptions: testCase.formatOptions, + }), + ).toMatchSnapshot(); + }); } export { testFormat as run }; diff --git a/tests/config/test-second-format.js b/tests/config/test-second-format.js index ee4c9b9d3..b8b3ce8f3 100644 --- a/tests/config/test-second-format.js +++ b/tests/config/test-second-format.js @@ -1,30 +1,72 @@ import * as failedTests from "./failed-format-tests.js"; import { format } from "./run-prettier.js"; -async function testSecondFormat(testCase) { - const { code, filepath, formatOptions } = testCase; - const formatResult = await testCase.runFormat(); +/** +@import {TestCase} from "./run-test.js" +*/ + +/** +@param {TestCase} testCase +@param {string} name +*/ +function testSecondFormat(testCase, name) { + test(name, async () => { + const { + changed, + eolVisualizedOutput: firstOutput, + output, + } = await testCase.runFormat(); + + if (!changed) { + return; + } + + const { filepath, formatOptions } = testCase; - const isUnstableTest = failedTests.isUnstable(filepath, formatOptions); - if ( - (formatResult.changed || isUnstableTest) && - // No range and cursor - formatResult.input === code - ) { - const { eolVisualizedOutput: firstOutput, output } = formatResult; const { eolVisualizedOutput: secondOutput } = await format( output, formatOptions, ); + + const isUnstableTest = failedTests.isUnstable(filepath, formatOptions); + if (isUnstableTest && secondOutput === firstOutput) { + throw new Error( + `Unstable file '${filepath}' is stable now, please remove from the 'unstableTests' list.`, + ); + } + // To keep eye on failed tests, this assert never supposed to pass, // if it fails, just remove the file from `unstableTests` if (isUnstableTest) { - expect(secondOutput).not.toEqual(firstOutput); + expect(secondOutput).not.toBe(firstOutput); return; } - expect(secondOutput).toEqual(firstOutput); + expect(secondOutput).toBe(firstOutput); + }); +} + +/** +@param {TestCase} testCase +@return {boolean} +*/ +function shouldSkip(testCase) { + if (testCase.expectFail) { + return true; } + + const { rangeStart, rangeEnd, cursorOffset } = testCase.formatOptions; + + // No range and cursor + if ( + typeof cursorOffset === "number" || + typeof rangeStart === "number" || + typeof rangeEnd === "number" + ) { + return true; + } + + return false; } -export { testSecondFormat as run }; +export { testSecondFormat as run, shouldSkip as skip }; diff --git a/tests/config/test-variant-coverage.js b/tests/config/test-variant-coverage.js index 28b8888b8..a11c1c6e8 100644 --- a/tests/config/test-variant-coverage.js +++ b/tests/config/test-variant-coverage.js @@ -1,17 +1,33 @@ import getCreateParser from "./get-create-parser.js"; import getVariantCoverage from "./get-variant-coverage.js"; -async function testVariantCoverage(testCase) { - const { code, formatOptions } = testCase; +/** +@import {TestCase} from "./run-test.js" +*/ + +/** +@param {TestCase} testCase +@param {string} name +*/ +function testVariantCoverage(testCase, name) { + test(name, async () => { + const { code, formatOptions } = testCase; - if (formatOptions.parser === "slang") { const createParser = await getCreateParser(); const variantCoverage = await getVariantCoverage(); const { parseOutput } = createParser(code, formatOptions); // Check coverage variantCoverage(parseOutput.tree.asNonterminalNode()); - } + }); +} + +/** +@param {TestCase} testCase +@return {boolean} +*/ +function shouldSkip(testCase) { + return testCase.expectFail; } -export { testVariantCoverage as run }; +export { testVariantCoverage as run, shouldSkip as skip }; diff --git a/tests/config/utilities.js b/tests/config/utilities.js index e731a6bca..7f68b7be8 100644 --- a/tests/config/utilities.js +++ b/tests/config/utilities.js @@ -20,4 +20,4 @@ const shouldThrowOnFormat = ({ filename }, options) => { return false; }; -export { normalizeDirectory, isErrorTest, shouldThrowOnFormat }; +export { isErrorTest, normalizeDirectory, shouldThrowOnFormat }; diff --git a/tests/config/utils/visualize-end-of-line.js b/tests/config/visualize-end-of-line.js similarity index 100% rename from tests/config/utils/visualize-end-of-line.js rename to tests/config/visualize-end-of-line.js diff --git a/tests/config/utils/visualize-range.js b/tests/config/visualize-range.js similarity index 100% rename from tests/config/utils/visualize-range.js rename to tests/config/visualize-range.js From c5cd47f3c24c2fa048dd9f068a6196095922796a Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 31 Mar 2026 09:39:34 -0300 Subject: [PATCH 4/5] removing the hardcoded printWith --- tests/config/run-test.js | 1 - .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../Arrays/__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 6 +-- .../__snapshots__/format.test.js.snap | 12 ++---- .../__snapshots__/format.test.js.snap | 12 ++---- .../__snapshots__/format.test.js.snap | 9 ++-- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../Empty/__snapshots__/format.test.js.snap | 6 +-- .../__snapshots__/format.test.js.snap | 3 +- .../Etc/__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 12 ++---- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 6 +-- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 6 +-- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 9 ++-- .../Inbox/__snapshots__/format.test.js.snap | 3 +- .../IndexOf/__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../Issues/__snapshots__/format.test.js.snap | 21 ++++------ .../__snapshots__/format.test.js.snap | 6 +-- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 6 +-- .../__snapshots__/format.test.js.snap | 3 +- .../Ownable/__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 42 +++++++------------ .../Pragma/__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../Proxy/__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 24 ++++------- .../__snapshots__/format.test.js.snap | 3 +- .../Tuples/__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 3 +- .../__snapshots__/format.test.js.snap | 9 ++-- .../quotes/__snapshots__/format.test.js.snap | 6 +-- .../strings/__snapshots__/format.test.js.snap | 3 +- 64 files changed, 111 insertions(+), 223 deletions(-) diff --git a/tests/config/run-test.js b/tests/config/run-test.js index 05287a920..3ccc39d3c 100644 --- a/tests/config/run-test.js +++ b/tests/config/run-test.js @@ -141,7 +141,6 @@ function getTestCase(fixture, parser) { const { text: code, options: formatOptions } = replacePlaceholders( originalText, { - printWidth: 80, filepath, ...context.options, parser, diff --git a/tests/format/AddressPayable/__snapshots__/format.test.js.snap b/tests/format/AddressPayable/__snapshots__/format.test.js.snap index d43ba4fee..ebf7210be 100644 --- a/tests/format/AddressPayable/__snapshots__/format.test.js.snap +++ b/tests/format/AddressPayable/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`AddressPayable.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.5.2; diff --git a/tests/format/AllSolidityFeatures/__snapshots__/format.test.js.snap b/tests/format/AllSolidityFeatures/__snapshots__/format.test.js.snap index fc2750aa3..59feadc1a 100644 --- a/tests/format/AllSolidityFeatures/__snapshots__/format.test.js.snap +++ b/tests/format/AllSolidityFeatures/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`AllSolidityFeatures.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // Examples taken from the Solidity documentation online. pragma experimental ABIEncoderV2; diff --git a/tests/format/AllSolidityFeaturesV0.4.26/__snapshots__/format.test.js.snap b/tests/format/AllSolidityFeaturesV0.4.26/__snapshots__/format.test.js.snap index a390e881c..348ecae62 100644 --- a/tests/format/AllSolidityFeaturesV0.4.26/__snapshots__/format.test.js.snap +++ b/tests/format/AllSolidityFeaturesV0.4.26/__snapshots__/format.test.js.snap @@ -4,8 +4,7 @@ exports[`AllSolidityFeatures.sol - {"compiler":"0.4.26"} format 1`] = ` ====================================options===================================== compiler: "0.4.26" parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract c { function c() diff --git a/tests/format/Arrays/__snapshots__/format.test.js.snap b/tests/format/Arrays/__snapshots__/format.test.js.snap index dd5abe7ef..91ffb32ce 100644 --- a/tests/format/Arrays/__snapshots__/format.test.js.snap +++ b/tests/format/Arrays/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Arrays.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.5.2; diff --git a/tests/format/Assembly/__snapshots__/format.test.js.snap b/tests/format/Assembly/__snapshots__/format.test.js.snap index a9aeeb64c..5b5206cdd 100644 --- a/tests/format/Assembly/__snapshots__/format.test.js.snap +++ b/tests/format/Assembly/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Assembly.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract Assembly { function ifAssembly() { diff --git a/tests/format/AssemblyV0.4.26/__snapshots__/format.test.js.snap b/tests/format/AssemblyV0.4.26/__snapshots__/format.test.js.snap index 3055de494..c69e4f78b 100644 --- a/tests/format/AssemblyV0.4.26/__snapshots__/format.test.js.snap +++ b/tests/format/AssemblyV0.4.26/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Assembly.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.4.26; diff --git a/tests/format/Assignments/__snapshots__/format.test.js.snap b/tests/format/Assignments/__snapshots__/format.test.js.snap index 3a93ba3c0..a009289d8 100644 --- a/tests/format/Assignments/__snapshots__/format.test.js.snap +++ b/tests/format/Assignments/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Assignments.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract Assignments { address payable public inParentheses = (contractPointer.functionCall(data.data1,data.data2,IERC20(data.token).decimals(),currency)); diff --git a/tests/format/BasicIterator/__snapshots__/format.test.js.snap b/tests/format/BasicIterator/__snapshots__/format.test.js.snap index 29fb5dfe0..659a9799f 100644 --- a/tests/format/BasicIterator/__snapshots__/format.test.js.snap +++ b/tests/format/BasicIterator/__snapshots__/format.test.js.snap @@ -4,8 +4,7 @@ exports[`BasicIterator.sol - {"compiler":"0.4.26"} format 1`] = ` ====================================options===================================== compiler: "0.4.26" parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== /* This is a very simple demonstration of a while loops. Same as JS/c. diff --git a/tests/format/BinaryOperationHierarchy/__snapshots__/format.test.js.snap b/tests/format/BinaryOperationHierarchy/__snapshots__/format.test.js.snap index 01f307f94..12971bae1 100644 --- a/tests/format/BinaryOperationHierarchy/__snapshots__/format.test.js.snap +++ b/tests/format/BinaryOperationHierarchy/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Group.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity "0.8.28"; @@ -1300,8 +1299,7 @@ contract Group { exports[`Indent.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.28; diff --git a/tests/format/BinaryOperators/__snapshots__/format.test.js.snap b/tests/format/BinaryOperators/__snapshots__/format.test.js.snap index b84810b3e..cd47b0992 100644 --- a/tests/format/BinaryOperators/__snapshots__/format.test.js.snap +++ b/tests/format/BinaryOperators/__snapshots__/format.test.js.snap @@ -4,8 +4,7 @@ exports[`BinaryOperators.sol - {"experimentalOperatorPosition":"start"} format 1 ====================================options===================================== experimentalOperatorPosition: "start" parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract ArithmeticOperators { // ['+', '-', '*', '/', '%'] @@ -687,8 +686,7 @@ contract LogicalOperators { exports[`BinaryOperators.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract ArithmeticOperators { // ['+', '-', '*', '/', '%'] @@ -1371,8 +1369,7 @@ exports[`Parentheses.sol - {"experimentalOperatorPosition":"start"} format 1`] = ====================================options===================================== experimentalOperatorPosition: "start" parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity 0.5.8; @@ -1646,8 +1643,7 @@ contract Parentheses { exports[`Parentheses.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity 0.5.8; diff --git a/tests/format/BreakingChangesV0.7.4/__snapshots__/format.test.js.snap b/tests/format/BreakingChangesV0.7.4/__snapshots__/format.test.js.snap index 9c401ba26..3c381da13 100644 --- a/tests/format/BreakingChangesV0.7.4/__snapshots__/format.test.js.snap +++ b/tests/format/BreakingChangesV0.7.4/__snapshots__/format.test.js.snap @@ -5,8 +5,7 @@ exports[`BreakingChangesV0.7.4.sol - {"compiler":"0.7.3","bracketSpacing":true} bracketSpacing: true compiler: "0.7.3" parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.7.0; @@ -36,8 +35,7 @@ exports[`BreakingChangesV0.7.4.sol - {"compiler":"0.7.3"} format 1`] = ` ====================================options===================================== compiler: "0.7.3" parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.7.0; @@ -68,8 +66,7 @@ exports[`BreakingChangesV0.7.4.sol - {"compiler":"0.7.4","bracketSpacing":true} bracketSpacing: true compiler: "0.7.4" parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.7.0; @@ -104,8 +101,7 @@ exports[`BreakingChangesV0.7.4.sol - {"compiler":"0.7.4"} format 1`] = ` ====================================options===================================== compiler: "0.7.4" parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.7.0; diff --git a/tests/format/BreakingChangesV0.8.0/__snapshots__/format.test.js.snap b/tests/format/BreakingChangesV0.8.0/__snapshots__/format.test.js.snap index df792faa0..03da229e0 100644 --- a/tests/format/BreakingChangesV0.8.0/__snapshots__/format.test.js.snap +++ b/tests/format/BreakingChangesV0.8.0/__snapshots__/format.test.js.snap @@ -4,8 +4,7 @@ exports[`BreakingChangesV0.8.0.sol - {"compiler":"0.7.0"} format 1`] = ` ====================================options===================================== compiler: "0.7.0" parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <=0.8.5; @@ -92,8 +91,7 @@ exports[`BreakingChangesV0.8.0.sol - {"compiler":"0.8.0"} format 1`] = ` ====================================options===================================== compiler: "0.8.0" parsers: ["antlr"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <=0.8.5; @@ -179,8 +177,7 @@ contract BreakingChangesV080 { exports[`BreakingChangesV0.8.0.sol format 1`] = ` ====================================options===================================== parsers: ["antlr"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <=0.8.5; diff --git a/tests/format/Comments/__snapshots__/format.test.js.snap b/tests/format/Comments/__snapshots__/format.test.js.snap index 1ea75d1d5..cd8b288d0 100644 --- a/tests/format/Comments/__snapshots__/format.test.js.snap +++ b/tests/format/Comments/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Comments.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract Comments1 { /* solhint-disable var-name-mixedcase */ diff --git a/tests/format/Conditional/__snapshots__/format.test.js.snap b/tests/format/Conditional/__snapshots__/format.test.js.snap index e2aa8f101..041c1f6ad 100644 --- a/tests/format/Conditional/__snapshots__/format.test.js.snap +++ b/tests/format/Conditional/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Conditional.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.4.24; diff --git a/tests/format/Constructors/__snapshots__/format.test.js.snap b/tests/format/Constructors/__snapshots__/format.test.js.snap index 380acdd4a..8e7c096fd 100644 --- a/tests/format/Constructors/__snapshots__/format.test.js.snap +++ b/tests/format/Constructors/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Constructors.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.5.2; diff --git a/tests/format/ConstructorsV0.4.26/__snapshots__/format.test.js.snap b/tests/format/ConstructorsV0.4.26/__snapshots__/format.test.js.snap index 5f7987d73..5d26f632b 100644 --- a/tests/format/ConstructorsV0.4.26/__snapshots__/format.test.js.snap +++ b/tests/format/ConstructorsV0.4.26/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Constructors.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.4.26; diff --git a/tests/format/ContractDefinitions/__snapshots__/format.test.js.snap b/tests/format/ContractDefinitions/__snapshots__/format.test.js.snap index 28c4eee0f..70dd51649 100644 --- a/tests/format/ContractDefinitions/__snapshots__/format.test.js.snap +++ b/tests/format/ContractDefinitions/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`ContractDefinitions.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract ContractDefinition is Contract1, Contract2, Contract3, Contract4, Contract5 { } diff --git a/tests/format/CustomErrors/__snapshots__/format.test.js.snap b/tests/format/CustomErrors/__snapshots__/format.test.js.snap index fb2ceab37..b497c544b 100644 --- a/tests/format/CustomErrors/__snapshots__/format.test.js.snap +++ b/tests/format/CustomErrors/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`CustomErrors.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.8.4; diff --git a/tests/format/Empty/__snapshots__/format.test.js.snap b/tests/format/Empty/__snapshots__/format.test.js.snap index 0d1b911dd..a70f4aa6a 100644 --- a/tests/format/Empty/__snapshots__/format.test.js.snap +++ b/tests/format/Empty/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`EmptyFile.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== =====================================output===================================== @@ -15,8 +14,7 @@ printWidth: 80 exports[`EmptyFileWithComments.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT diff --git a/tests/format/EnumDefinitions/__snapshots__/format.test.js.snap b/tests/format/EnumDefinitions/__snapshots__/format.test.js.snap index b6ae4f685..cbf2a8605 100644 --- a/tests/format/EnumDefinitions/__snapshots__/format.test.js.snap +++ b/tests/format/EnumDefinitions/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`EnumDefinitions.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract EnumDefinitions { enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill } diff --git a/tests/format/Etc/__snapshots__/format.test.js.snap b/tests/format/Etc/__snapshots__/format.test.js.snap index 89806ac97..6173d84fd 100644 --- a/tests/format/Etc/__snapshots__/format.test.js.snap +++ b/tests/format/Etc/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Etc.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.4.24; diff --git a/tests/format/ExperimentalTernaries/__snapshots__/format.test.js.snap b/tests/format/ExperimentalTernaries/__snapshots__/format.test.js.snap index c3d34c710..087be71ba 100644 --- a/tests/format/ExperimentalTernaries/__snapshots__/format.test.js.snap +++ b/tests/format/ExperimentalTernaries/__snapshots__/format.test.js.snap @@ -4,9 +4,8 @@ exports[`ExperimentalTernaries.sol - {"experimentalTernaries":true,"tabWidth":1} ====================================options===================================== experimentalTernaries: true parsers: ["slang"] -printWidth: 80 tabWidth: 1 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.4.24; @@ -515,9 +514,8 @@ exports[`ExperimentalTernaries.sol - {"experimentalTernaries":true,"useTabs":tru ====================================options===================================== experimentalTernaries: true parsers: ["slang"] -printWidth: 80 useTabs: true - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.4.24; @@ -1030,8 +1028,7 @@ exports[`ExperimentalTernaries.sol - {"experimentalTernaries":true} format 1`] = ====================================options===================================== experimentalTernaries: true parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.4.24; @@ -1543,8 +1540,7 @@ contract Conditional { exports[`ExperimentalTernaries.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.4.24; diff --git a/tests/format/ForStatements/__snapshots__/format.test.js.snap b/tests/format/ForStatements/__snapshots__/format.test.js.snap index 081434086..b5d0487cc 100644 --- a/tests/format/ForStatements/__snapshots__/format.test.js.snap +++ b/tests/format/ForStatements/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`ForStatements.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract ForStatements { uint constant LONG_VARIABLE = 1; diff --git a/tests/format/FunctionCalls/__snapshots__/format.test.js.snap b/tests/format/FunctionCalls/__snapshots__/format.test.js.snap index bc60febca..7e89f0c1a 100644 --- a/tests/format/FunctionCalls/__snapshots__/format.test.js.snap +++ b/tests/format/FunctionCalls/__snapshots__/format.test.js.snap @@ -4,8 +4,7 @@ exports[`FunctionCalls.sol - {"bracketSpacing":true} format 1`] = ` ====================================options===================================== bracketSpacing: true parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract FunctionCalls { function foo() { @@ -156,8 +155,7 @@ contract FunctionCalls { exports[`FunctionCalls.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract FunctionCalls { function foo() { diff --git a/tests/format/FunctionDefinitions/__snapshots__/format.test.js.snap b/tests/format/FunctionDefinitions/__snapshots__/format.test.js.snap index 392b9ac29..b396a9543 100644 --- a/tests/format/FunctionDefinitions/__snapshots__/format.test.js.snap +++ b/tests/format/FunctionDefinitions/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`FunctionDefinitions.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== interface FunctionInterfaces { function noParamsNoModifiersNoReturns(); diff --git a/tests/format/FunctionDefinitionsV0.5.0/__snapshots__/format.test.js.snap b/tests/format/FunctionDefinitionsV0.5.0/__snapshots__/format.test.js.snap index dd5da88e6..8ff49d133 100644 --- a/tests/format/FunctionDefinitionsV0.5.0/__snapshots__/format.test.js.snap +++ b/tests/format/FunctionDefinitionsV0.5.0/__snapshots__/format.test.js.snap @@ -4,8 +4,7 @@ exports[`FunctionDefinitions.sol - {"compiler":"0.5.17"} format 1`] = ` ====================================options===================================== compiler: "0.5.17" parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract FunctionDefinitions { function () external {} diff --git a/tests/format/HexLiteral/__snapshots__/format.test.js.snap b/tests/format/HexLiteral/__snapshots__/format.test.js.snap index beb607527..ae929fbc6 100644 --- a/tests/format/HexLiteral/__snapshots__/format.test.js.snap +++ b/tests/format/HexLiteral/__snapshots__/format.test.js.snap @@ -3,9 +3,8 @@ exports[`HexLiteral.sol - {"singleQuote":false} format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 singleQuote: false - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; @@ -30,9 +29,8 @@ contract HexLiteral { exports[`HexLiteral.sol - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 singleQuote: true - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; diff --git a/tests/format/IfStatements/__snapshots__/format.test.js.snap b/tests/format/IfStatements/__snapshots__/format.test.js.snap index 57e3fac17..eb6c37a76 100644 --- a/tests/format/IfStatements/__snapshots__/format.test.js.snap +++ b/tests/format/IfStatements/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`IfStatements.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract IfStatements { function hi() public { diff --git a/tests/format/Immutable/__snapshots__/format.test.js.snap b/tests/format/Immutable/__snapshots__/format.test.js.snap index dfd46f5a5..f9ab3acfe 100644 --- a/tests/format/Immutable/__snapshots__/format.test.js.snap +++ b/tests/format/Immutable/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Immutable.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity >0.6.4 <0.7.0; diff --git a/tests/format/ImportDirective/__snapshots__/format.test.js.snap b/tests/format/ImportDirective/__snapshots__/format.test.js.snap index 448739bb6..27f2a9daf 100644 --- a/tests/format/ImportDirective/__snapshots__/format.test.js.snap +++ b/tests/format/ImportDirective/__snapshots__/format.test.js.snap @@ -4,8 +4,7 @@ exports[`ImportDirectives.sol - {"bracketSpacing":true} format 1`] = ` ====================================options===================================== bracketSpacing: true parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== import "SomeFile.sol"; import "SomeFile.sol" as SomeOtherFile; @@ -59,8 +58,7 @@ exports[`ImportDirectives.sol - {"compiler":"0.7.3"} format 1`] = ` ====================================options===================================== compiler: "0.7.3" parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== import "SomeFile.sol"; import "SomeFile.sol" as SomeOtherFile; @@ -99,8 +97,7 @@ import {IERC7579Module, IERC7579Validator, IERC7579Execution, IERC7579AccountCon exports[`ImportDirectives.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== import "SomeFile.sol"; import "SomeFile.sol" as SomeOtherFile; diff --git a/tests/format/Inbox/__snapshots__/format.test.js.snap b/tests/format/Inbox/__snapshots__/format.test.js.snap index dbbfcb4df..b9f345e93 100644 --- a/tests/format/Inbox/__snapshots__/format.test.js.snap +++ b/tests/format/Inbox/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Inbox.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // This comment spans one line diff --git a/tests/format/IndexOf/__snapshots__/format.test.js.snap b/tests/format/IndexOf/__snapshots__/format.test.js.snap index ea8d090e9..817ee88a3 100644 --- a/tests/format/IndexOf/__snapshots__/format.test.js.snap +++ b/tests/format/IndexOf/__snapshots__/format.test.js.snap @@ -4,8 +4,7 @@ exports[`IndexOf.sol - {"compiler":"0.4.26"} format 1`] = ` ====================================options===================================== compiler: "0.4.26" parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract IndexOf { diff --git a/tests/format/IndexRangeAccess/__snapshots__/format.test.js.snap b/tests/format/IndexRangeAccess/__snapshots__/format.test.js.snap index a26113840..32a93c39a 100644 --- a/tests/format/IndexRangeAccess/__snapshots__/format.test.js.snap +++ b/tests/format/IndexRangeAccess/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`IndexRangeAccess.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.6.4; diff --git a/tests/format/Issues/__snapshots__/format.test.js.snap b/tests/format/Issues/__snapshots__/format.test.js.snap index 2edcfdff3..d73f3b232 100644 --- a/tests/format/Issues/__snapshots__/format.test.js.snap +++ b/tests/format/Issues/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Issue205.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract Example { using SafeMath for uint256; @@ -41,8 +40,7 @@ contract Example { exports[`Issue289.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract Issue289 { function f() { @@ -66,8 +64,7 @@ contract Issue289 { exports[`Issue355.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity 0.6.12; @@ -102,8 +99,7 @@ contract Bug { exports[`Issue385.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract Issue385 { function emptyTryCatch() { @@ -140,8 +136,7 @@ contract Issue385 { exports[`Issue564.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract Issue564 { function isAuthorized( @@ -173,8 +168,7 @@ contract Issue564 { exports[`Issue799.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== struct EmptyStruct {} @@ -187,8 +181,7 @@ struct EmptyStruct {} exports[`Issue843.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.8.0; diff --git a/tests/format/Libraries/__snapshots__/format.test.js.snap b/tests/format/Libraries/__snapshots__/format.test.js.snap index e8f7cda26..5f04ea49f 100644 --- a/tests/format/Libraries/__snapshots__/format.test.js.snap +++ b/tests/format/Libraries/__snapshots__/format.test.js.snap @@ -4,8 +4,7 @@ exports[`Libraries.sol - {"bracketSpacing":true} format 1`] = ` ====================================options===================================== bracketSpacing: true parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== using Lib for uint; using Lib for @@ -56,8 +55,7 @@ using { exports[`Libraries.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== using Lib for uint; using Lib for diff --git a/tests/format/Markdown/__snapshots__/format.test.js.snap b/tests/format/Markdown/__snapshots__/format.test.js.snap index 868ecf560..d794a864d 100644 --- a/tests/format/Markdown/__snapshots__/format.test.js.snap +++ b/tests/format/Markdown/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Markdown.md format 1`] = ` ====================================options===================================== parsers: ["markdown"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== # Embedded Solidity Code diff --git a/tests/format/MemberAccess/__snapshots__/format.test.js.snap b/tests/format/MemberAccess/__snapshots__/format.test.js.snap index b352f7005..04061c8c5 100644 --- a/tests/format/MemberAccess/__snapshots__/format.test.js.snap +++ b/tests/format/MemberAccess/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`MemberAccess.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.6.0; diff --git a/tests/format/ModifierDefinitions/__snapshots__/format.test.js.snap b/tests/format/ModifierDefinitions/__snapshots__/format.test.js.snap index 2712cda4b..6398d6a2f 100644 --- a/tests/format/ModifierDefinitions/__snapshots__/format.test.js.snap +++ b/tests/format/ModifierDefinitions/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`ModifierDefinitions.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract ModifierDefinitions { modifier noParams() {} diff --git a/tests/format/ModifierInvocations/__snapshots__/format.test.js.snap b/tests/format/ModifierInvocations/__snapshots__/format.test.js.snap index 8d43e27b5..c78d0dfe0 100644 --- a/tests/format/ModifierInvocations/__snapshots__/format.test.js.snap +++ b/tests/format/ModifierInvocations/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`ModifierInvocations.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; diff --git a/tests/format/ModifierInvocationsV0.4.26/__snapshots__/format.test.js.snap b/tests/format/ModifierInvocationsV0.4.26/__snapshots__/format.test.js.snap index 9386e89ee..7067a06ed 100644 --- a/tests/format/ModifierInvocationsV0.4.26/__snapshots__/format.test.js.snap +++ b/tests/format/ModifierInvocationsV0.4.26/__snapshots__/format.test.js.snap @@ -4,8 +4,7 @@ exports[`ModifierInvocations.sol - {"compiler":"0.4.26"} format 1`] = ` ====================================options===================================== compiler: "0.4.26" parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.4.26; diff --git a/tests/format/MultipartStrings/__snapshots__/format.test.js.snap b/tests/format/MultipartStrings/__snapshots__/format.test.js.snap index e228b2213..ca66d779b 100644 --- a/tests/format/MultipartStrings/__snapshots__/format.test.js.snap +++ b/tests/format/MultipartStrings/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`MultipartStrings.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract MultipartStrings { bytes h1 = hex'beef'; diff --git a/tests/format/NameValueExpression/__snapshots__/format.test.js.snap b/tests/format/NameValueExpression/__snapshots__/format.test.js.snap index e73cf2058..5973a06a8 100644 --- a/tests/format/NameValueExpression/__snapshots__/format.test.js.snap +++ b/tests/format/NameValueExpression/__snapshots__/format.test.js.snap @@ -4,8 +4,7 @@ exports[`NameValueExpression.sol - {"bracketSpacing":true} format 1`] = ` ====================================options===================================== bracketSpacing: true parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity >=0.6.2 <0.7.0; @@ -36,8 +35,7 @@ contract NameValueExpression { exports[`NameValueExpression.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity >=0.6.2 <0.7.0; diff --git a/tests/format/NumberLiteral/__snapshots__/format.test.js.snap b/tests/format/NumberLiteral/__snapshots__/format.test.js.snap index 55a935f67..31a8fda38 100644 --- a/tests/format/NumberLiteral/__snapshots__/format.test.js.snap +++ b/tests/format/NumberLiteral/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`NumberLiteral.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; diff --git a/tests/format/Ownable/__snapshots__/format.test.js.snap b/tests/format/Ownable/__snapshots__/format.test.js.snap index d5b5daa85..12ea0df69 100644 --- a/tests/format/Ownable/__snapshots__/format.test.js.snap +++ b/tests/format/Ownable/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Ownable.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.4.24; diff --git a/tests/format/Parentheses/__snapshots__/format.test.js.snap b/tests/format/Parentheses/__snapshots__/format.test.js.snap index adff608bc..7f8cf5897 100644 --- a/tests/format/Parentheses/__snapshots__/format.test.js.snap +++ b/tests/format/Parentheses/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`AddNoParentheses.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; @@ -199,8 +198,7 @@ contract AddNoParentheses { exports[`BitAndNoParentheses.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; @@ -395,8 +393,7 @@ contract BitAndNoParentheses { exports[`BitOrNoParentheses.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; @@ -591,8 +588,7 @@ contract BitOrNoParentheses { exports[`BitXorNoParentheses.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; @@ -787,8 +783,7 @@ contract BitXorNoParentheses { exports[`DivNoParentheses.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; @@ -983,8 +978,7 @@ contract DivNoParentheses { exports[`EqualParentheses.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.28; @@ -1206,8 +1200,7 @@ contract EqualParentheses { exports[`ExpNoParentheses.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; @@ -1402,8 +1395,7 @@ contract ExpNoParentheses { exports[`LogicNoParentheses.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; @@ -1490,8 +1482,7 @@ contract LogicNoParentheses { exports[`ModNoParentheses.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; @@ -1686,8 +1677,7 @@ contract ModNoParentheses { exports[`MulNoParentheses.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; @@ -1882,8 +1872,7 @@ contract MulNoParentheses { exports[`NotEqualParentheses.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.28; @@ -2105,8 +2094,7 @@ contract NotEqualParentheses { exports[`ShiftLNoParentheses.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; @@ -2301,8 +2289,7 @@ contract ShiftLNoParentheses { exports[`ShiftRNoParentheses.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; @@ -2497,8 +2484,7 @@ contract ShiftRNoParentheses { exports[`SubNoParentheses.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== // SPDX-License-Identifier: MIT pragma solidity 0.8.34; diff --git a/tests/format/Pragma/__snapshots__/format.test.js.snap b/tests/format/Pragma/__snapshots__/format.test.js.snap index f3b9ea2e1..d4a70eec3 100644 --- a/tests/format/Pragma/__snapshots__/format.test.js.snap +++ b/tests/format/Pragma/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Pragma.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity >=0.4.21 <0.6.0; pragma solidity >=0.4.21 <=0.6.0 ; diff --git a/tests/format/PrettierIgnore/__snapshots__/format.test.js.snap b/tests/format/PrettierIgnore/__snapshots__/format.test.js.snap index cd83d757d..cb73171a7 100644 --- a/tests/format/PrettierIgnore/__snapshots__/format.test.js.snap +++ b/tests/format/PrettierIgnore/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`PrettierIgnore.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.6.0; diff --git a/tests/format/Proxy/__snapshots__/format.test.js.snap b/tests/format/Proxy/__snapshots__/format.test.js.snap index e02939abc..55200bbf1 100644 --- a/tests/format/Proxy/__snapshots__/format.test.js.snap +++ b/tests/format/Proxy/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Proxy.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.4.24; diff --git a/tests/format/RespectDefaultOptions/__snapshots__/format.test.js.snap b/tests/format/RespectDefaultOptions/__snapshots__/format.test.js.snap index a4a1b7ce6..54655dd4f 100644 --- a/tests/format/RespectDefaultOptions/__snapshots__/format.test.js.snap +++ b/tests/format/RespectDefaultOptions/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`respect-default-options.js format 1`] = ` ====================================options===================================== parsers: ["babel"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== function a() { return {key:value}; diff --git a/tests/format/SampleCrowdsale/__snapshots__/format.test.js.snap b/tests/format/SampleCrowdsale/__snapshots__/format.test.js.snap index 42dfa0811..fddbd1029 100644 --- a/tests/format/SampleCrowdsale/__snapshots__/format.test.js.snap +++ b/tests/format/SampleCrowdsale/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`SampleCrowdsale.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.4.18; diff --git a/tests/format/SimpleAuction/__snapshots__/format.test.js.snap b/tests/format/SimpleAuction/__snapshots__/format.test.js.snap index ce64316a9..5bf13d6d8 100644 --- a/tests/format/SimpleAuction/__snapshots__/format.test.js.snap +++ b/tests/format/SimpleAuction/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`SimpleAuction.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.4.22; diff --git a/tests/format/SimpleStorage/__snapshots__/format.test.js.snap b/tests/format/SimpleStorage/__snapshots__/format.test.js.snap index c7cb6671f..237023654 100644 --- a/tests/format/SimpleStorage/__snapshots__/format.test.js.snap +++ b/tests/format/SimpleStorage/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`SimpleStorage.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.4.0; diff --git a/tests/format/SplittableCommodity/__snapshots__/format.test.js.snap b/tests/format/SplittableCommodity/__snapshots__/format.test.js.snap index 3a1cf0b4e..1f7f1bc7a 100644 --- a/tests/format/SplittableCommodity/__snapshots__/format.test.js.snap +++ b/tests/format/SplittableCommodity/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`SplittableCommodity.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.4.24; diff --git a/tests/format/StateVariableDeclarations/__snapshots__/format.test.js.snap b/tests/format/StateVariableDeclarations/__snapshots__/format.test.js.snap index 3a6337104..876b40755 100644 --- a/tests/format/StateVariableDeclarations/__snapshots__/format.test.js.snap +++ b/tests/format/StateVariableDeclarations/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`StateVariableDeclarations.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract Contract { bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x035aff83d86937d35b32e04f0ddc6ff469290eef2f1b692d8a815c89404d4749; diff --git a/tests/format/StringLiteral/__snapshots__/format.test.js.snap b/tests/format/StringLiteral/__snapshots__/format.test.js.snap index ed7b3f18b..cb91f87ea 100644 --- a/tests/format/StringLiteral/__snapshots__/format.test.js.snap +++ b/tests/format/StringLiteral/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`StringLiteral.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract StringLiteral { bytes32 public constant PERMIT_TYPEHASH = keccak256( diff --git a/tests/format/StyleGuide/__snapshots__/format.test.js.snap b/tests/format/StyleGuide/__snapshots__/format.test.js.snap index 506f2cf7c..18679c0c0 100644 --- a/tests/format/StyleGuide/__snapshots__/format.test.js.snap +++ b/tests/format/StyleGuide/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`BlankLines.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity >=0.4.0 <0.7.0; @@ -49,8 +48,7 @@ contract A { exports[`ControlStructures.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity >=0.4.0 <0.6.0; @@ -170,8 +168,7 @@ contract ControlStructures { exports[`FunctionDeclaration.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity >=0.4.0 <0.7.0; @@ -461,8 +458,7 @@ contract X is B, C, D { exports[`Mappings.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity >=0.4.0 <0.7.0; @@ -492,8 +488,7 @@ contract Mappings { exports[`MaximumLineLength.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity >=0.4.0 <0.6.0; @@ -647,8 +642,7 @@ contract EventDefinitionsAndEventEmitters { exports[`OtherRecommendations.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity >=0.4.0 <0.6.0; @@ -714,8 +708,7 @@ contract OtherRecommendations { exports[`VariableDeclarations.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity >=0.4.0 <0.7.0; @@ -737,8 +730,7 @@ contract VariableDeclarations { exports[`WhitespaceInExpressions.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity >=0.4.0 <0.6.0; diff --git a/tests/format/TryCatch/__snapshots__/format.test.js.snap b/tests/format/TryCatch/__snapshots__/format.test.js.snap index 99859fea5..107bcf94a 100644 --- a/tests/format/TryCatch/__snapshots__/format.test.js.snap +++ b/tests/format/TryCatch/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`TryCatch.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.6.0; diff --git a/tests/format/Tuples/__snapshots__/format.test.js.snap b/tests/format/Tuples/__snapshots__/format.test.js.snap index 8104a38bb..cdd04adec 100644 --- a/tests/format/Tuples/__snapshots__/format.test.js.snap +++ b/tests/format/Tuples/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`Tuples.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.5.0; diff --git a/tests/format/TypeDefinition/__snapshots__/format.test.js.snap b/tests/format/TypeDefinition/__snapshots__/format.test.js.snap index ba7c9bd26..e38685920 100644 --- a/tests/format/TypeDefinition/__snapshots__/format.test.js.snap +++ b/tests/format/TypeDefinition/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`TypeDefinition.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity ^0.8.8; diff --git a/tests/format/WhileStatements/__snapshots__/format.test.js.snap b/tests/format/WhileStatements/__snapshots__/format.test.js.snap index 54b7c0507..0358c4b16 100644 --- a/tests/format/WhileStatements/__snapshots__/format.test.js.snap +++ b/tests/format/WhileStatements/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`WhileStatements.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== contract WhileStatements { uint constant LONG_VARIABLE = 1; diff --git a/tests/format/WrongCompiler/__snapshots__/format.test.js.snap b/tests/format/WrongCompiler/__snapshots__/format.test.js.snap index a0cabe27c..fbe87e04e 100644 --- a/tests/format/WrongCompiler/__snapshots__/format.test.js.snap +++ b/tests/format/WrongCompiler/__snapshots__/format.test.js.snap @@ -4,8 +4,7 @@ exports[`WrongCompiler.sol - {"compiler":"0.8.4"} format 1`] = ` ====================================options===================================== compiler: "0.8.4" parsers: ["antlr"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity >= 0.7.0; pragma solidity >0.7.2 <= 0.7.5; @@ -22,8 +21,7 @@ exports[`WrongCompiler.sol - {"compiler":"v0.7.3+commit.9bfce1f6"} format 1`] = ====================================options===================================== compiler: "v0.7.3+commit.9bfce1f6" parsers: ["antlr"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity >= 0.7.0; pragma solidity >0.7.2 <= 0.7.5; @@ -40,8 +38,7 @@ exports[`WrongCompiler.sol - {"compiler":"v0.7.5-nightly.2020.11.9+commit.41f503 ====================================options===================================== compiler: "v0.7.5-nightly.2020.11.9+commit.41f50365" parsers: ["antlr"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== pragma solidity >= 0.7.0; pragma solidity >0.7.2 <= 0.7.5; diff --git a/tests/format/quotes/__snapshots__/format.test.js.snap b/tests/format/quotes/__snapshots__/format.test.js.snap index c9acbab68..3e560c26d 100644 --- a/tests/format/quotes/__snapshots__/format.test.js.snap +++ b/tests/format/quotes/__snapshots__/format.test.js.snap @@ -3,9 +3,8 @@ exports[`Quotes.sol - {"singleQuote":false} format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 singleQuote: false - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== import 'someContract.sol'; import "someOtherContract.sol"; @@ -62,9 +61,8 @@ contract Foo { exports[`Quotes.sol - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 singleQuote: true - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== import 'someContract.sol'; import "someOtherContract.sol"; diff --git a/tests/format/strings/__snapshots__/format.test.js.snap b/tests/format/strings/__snapshots__/format.test.js.snap index c8ec4abbf..c33d24108 100644 --- a/tests/format/strings/__snapshots__/format.test.js.snap +++ b/tests/format/strings/__snapshots__/format.test.js.snap @@ -3,8 +3,7 @@ exports[`strings.sol format 1`] = ` ====================================options===================================== parsers: ["slang"] -printWidth: 80 - printWidth: 80 | + printWidth: 80 (default) | =====================================input====================================== /* * @title String & slice utility library for Solidity contracts. From a5d4779886af9e5efe05484f4cda03efea24d185 Mon Sep 17 00:00:00 2001 From: Klaus Date: Wed, 1 Apr 2026 16:30:34 -0300 Subject: [PATCH 5/5] comments by default are undefined --- src/slang-utils/create-hug-function.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/slang-utils/create-hug-function.ts b/src/slang-utils/create-hug-function.ts index 2e343cd0a..b3c610640 100644 --- a/src/slang-utils/create-hug-function.ts +++ b/src/slang-utils/create-hug-function.ts @@ -18,20 +18,20 @@ export function createHugFunction( { kind: NonterminalKind.TupleExpression, loc: { ...loc }, - comments: [], + comments: undefined, items: Object.assign( Object.create(TupleValues.prototype) as TupleValues, { kind: NonterminalKind.TupleValues, loc: { ...loc }, - comments: [], + comments: undefined, items: [ Object.assign( Object.create(TupleValue.prototype) as TupleValue, { kind: NonterminalKind.TupleValue, loc: { ...loc }, - comments: [], + comments: undefined, expression: node } )