From 0f88bc3f2d005e308c1c32317cfcec99921ddee2 Mon Sep 17 00:00:00 2001 From: rvanasa Date: Thu, 9 Jan 2025 10:46:40 -0700 Subject: [PATCH] Fix corner case with exponential float literal --- tests/formatter.test.ts | 6 ++++++ wasm/Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/formatter.test.ts b/tests/formatter.test.ts index 5a374f6..781ad0a 100644 --- a/tests/formatter.test.ts +++ b/tests/formatter.test.ts @@ -516,6 +516,12 @@ public type T = { expect(await format('@abc')).toStrictEqual('@abc\n'); }); + test('scientific notation literals', async () => { + await expectFormatted('let f = 1e2;\n'); + await expectFormatted('let f = -1e-2;\n'); + await expectFormatted('let f = 1.7976931348623157e+308;\n'); + }); + test('multi-line text', async () => { await expectFormatted('"A\nB"\n'); await expectFormatted('" A\n B"\n'); diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index babfff1..8ab1eae 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -15,7 +15,7 @@ serde = { version = "1.0.143", features = ["derive"] } serde_json = "1.0.83" wasm-bindgen = { version = "=0.2.82" } serde-wasm-bindgen = "=0.4.3" -motoko = "0.0.29" +motoko = "0.0.30" console_error_panic_hook = { version = "0.1.6", optional = true }