From 9388b3f8257bc2e580deaece4cd2677928104fc6 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Thu, 2 Mar 2023 19:02:10 -0800 Subject: Add a zig fmt action (#2277) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add a zig fmt action * add failing file * Setup prettier better * Update prettier-fmt.yml * Fail on error * Update prettier-fmt.yml * boop * boop2 * tar.gz * Update zig-fmt.yml * Update zig-fmt.yml * Update zig-fmt.yml * Update zig-fmt.yml * Update zig-fmt.yml * boop * Update prettier-fmt.yml * tag * newlines * multiline * fixup * Update zig-fmt.yml * update it * fixup * both * w * Update prettier-fmt.yml * prettier all the things * Update package.json * zig fmt * ❌ ✅ * bump * . * quotes * fix prettier ignore * once more * Update prettier-fmt.yml * Update fallback.ts * consistentcy --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> --- test/snippets/latin1-chars-in-regexp.js | 34 +++++++-------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'test/snippets/latin1-chars-in-regexp.js') diff --git a/test/snippets/latin1-chars-in-regexp.js b/test/snippets/latin1-chars-in-regexp.js index 1a533b1e1..0ba85d100 100644 --- a/test/snippets/latin1-chars-in-regexp.js +++ b/test/snippets/latin1-chars-in-regexp.js @@ -10,40 +10,24 @@ export var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g; export var re_btou = new RegExp( - [ - "[\xC0-\xDF][\x80-\xBF]", - "[\xE0-\xEF][\x80-\xBF]{2}", - "[\xF0-\xF7][\x80-\xBF]{3}", - ].join("|"), + ["[\xC0-\xDF][\x80-\xBF]", "[\xE0-\xEF][\x80-\xBF]{2}", "[\xF0-\xF7][\x80-\xBF]{3}"].join("|"), "g", ); const encoder = new TextEncoder(); -const realLines = [ - "[\xC0-\xDF][\x80-\xBF]", - "[\xE0-\xEF][\x80-\xBF]{2}", - "[\xF0-\xF7][\x80-\xBF]{3}", -]; -const real = realLines.map((input) => Array.from(encoder.encode(input))); +const realLines = ["[\xC0-\xDF][\x80-\xBF]", "[\xE0-\xEF][\x80-\xBF]{2}", "[\xF0-\xF7][\x80-\xBF]{3}"]; +const real = realLines.map(input => Array.from(encoder.encode(input))); const expected = [ [91, 195, 128, 45, 195, 159, 93, 91, 194, 128, 45, 194, 191, 93], - [ - 91, 195, 160, 45, 195, 175, 93, 91, 194, 128, 45, 194, 191, 93, 123, 50, - 125, - ], - [ - 91, 195, 176, 45, 195, 183, 93, 91, 194, 128, 45, 194, 191, 93, 123, 51, - 125, - ], + [91, 195, 160, 45, 195, 175, 93, 91, 194, 128, 45, 194, 191, 93, 123, 50, 125], + [91, 195, 176, 45, 195, 183, 93, 91, 194, 128, 45, 194, 191, 93, 123, 51, 125], ]; const newlinePreserved = `\n`; export function test() { - if ( - !real.every((point, i) => point.every((val, j) => val === expected[i][j])) - ) { + if (!real.every((point, i) => point.every((val, j) => val === expected[i][j]))) { throw new Error( `test failed ${JSON.stringify({ expected, real }, null, 2)}`, @@ -55,11 +39,7 @@ ${JSON.stringify({ expected, real }, null, 2)}`, } const decoder = new TextDecoder("utf8"); - if ( - !realLines.every( - (line, i) => decoder.decode(Uint8Array.from(expected[i])) === line, - ) - ) { + if (!realLines.every((line, i) => decoder.decode(Uint8Array.from(expected[i])) === line)) { throw new Error( `test failed. Lines did not match. ${JSON.stringify({ expected, real }, null, 2)}`, -- cgit v1.2.3