From 3715ae9464f2689f28c38abc99823c2053ed9bb9 Mon Sep 17 00:00:00 2001 From: duqingquan Date: Tue, 21 Nov 2023 17:55:54 +0800 Subject: [PATCH] =?UTF-8?q?number.fixed=20=E5=A2=9E=E5=8A=A0=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uts-tests/utssdk/JSON.uts | 13 +++++++++++++ uni_modules/uts-tests/utssdk/Number.uts | 15 +++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/uni_modules/uts-tests/utssdk/JSON.uts b/uni_modules/uts-tests/utssdk/JSON.uts index 6161f25..0bb9c93 100644 --- a/uni_modules/uts-tests/utssdk/JSON.uts +++ b/uni_modules/uts-tests/utssdk/JSON.uts @@ -279,6 +279,19 @@ export function testJSON() : Result { console.log(retStr) }) + test('UTSJSONOject', () => { + //var t1 = "1" + //const a = { + // test(){ + // t1 = "2" + // console.log("test") + // } + //} + //(a['test'] as ()=>void)() + //console.log(a['test']) + //expect(t1).toEqual("2") + }) + }) diff --git a/uni_modules/uts-tests/utssdk/Number.uts b/uni_modules/uts-tests/utssdk/Number.uts index ca405a9..3d9fda5 100644 --- a/uni_modules/uts-tests/utssdk/Number.uts +++ b/uni_modules/uts-tests/utssdk/Number.uts @@ -38,6 +38,21 @@ export function testNumber(): Result { expect(a2.toShort().toFixed(5)).toEqual("-122.00000"); // #endif + /** + * add since 2023-11-21 + * 发现部分场景在android 6 以下与web有差异,新增以下示例 + */ + let r = 2.449999999999999999; + let t1 = r.toFixed(1); + expect(t1).toEqual("2.5"); + + let r2 = 2.4499999999999999; + let t2 = r2.toFixed(1); + expect(t2).toEqual("2.4"); + + let r3 = -9007199254740991; + let t3 = r3.toFixed(15); + expect(t3).toEqual("-9007199254740991.000000000000000"); }) -- GitLab