From 6a6d410fcdbd175147e1eee9c76784accbedfb65 Mon Sep 17 00:00:00 2001 From: duqingquan Date: Tue, 25 Jun 2024 19:48:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E5=91=8A=E8=AD=A6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uts-tests/utssdk/Date.uts | 16 ++++++++-------- uni_modules/uts-tests/utssdk/String.uts | 19 ++++++++++--------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/uni_modules/uts-tests/utssdk/Date.uts b/uni_modules/uts-tests/utssdk/Date.uts index 9479963..8d74a5b 100644 --- a/uni_modules/uts-tests/utssdk/Date.uts +++ b/uni_modules/uts-tests/utssdk/Date.uts @@ -36,14 +36,14 @@ export function testDate() : Result { const date1 = new Date('01 Jan 1970 00:00:00 GMT'); const date2 = new Date('December 17, 1995 03:24:00'); - // // #ifndef APP-IOS - // expect(date1.toTimeString()).toEqual("08:00:00 GMT+0800 (中国标准时间)"); - // expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800 (中国标准时间)"); - // // #endif - // // #ifndef APP-ANDROID - // expect(date1.toTimeString()).toEqual("08:00:00 GMT+0800"); - // expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800"); - // // #endif + // #ifndef APP-IOS + expect(date1.toTimeString()).toEqual("08:00:00 GMT+0800 (中国标准时间)"); + expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800 (中国标准时间)"); + // #endif + // #ifndef APP-ANDROID + expect(date1.toTimeString()).toEqual("08:00:00 GMT+0800"); + expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800"); + // #endif }) test('toXString', () => { diff --git a/uni_modules/uts-tests/utssdk/String.uts b/uni_modules/uts-tests/utssdk/String.uts index e19fb3a..543ca5b 100644 --- a/uni_modules/uts-tests/utssdk/String.uts +++ b/uni_modules/uts-tests/utssdk/String.uts @@ -123,26 +123,27 @@ export function testString(): Result { // expect(result2!.length).toEqual(1); expect(result2![0]).toEqual("T"); + // #ifdef APP-ANDROID const gradientString = 'linear-gradient(to right, rgb(255, 0, 0), #00FF00, hsl(120, 100%, 50%))'; const pattern = /rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)|#([a-fA-F0-9]{2}){3}|hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)/g; const result3 = gradientString.match(pattern); - // expect(result3!.length).toEqual(3); - // expect(result3![0]).toEqual("rgb(255, 0, 0)"); - // expect(result3![2]).toEqual("hsl(120, 100%, 50%)"); + expect(result3!.length).toEqual(3); + expect(result3![0]).toEqual("rgb(255, 0, 0)"); + expect(result3![2]).toEqual("hsl(120, 100%, 50%)"); const pattern2 = /rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)|#([a-fA-F0-9]{2}){3}|hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)/; const result4 = gradientString.match(pattern2); - // expect(result4!.length).toEqual(8); - // expect(result4![0]).toEqual("rgb(255, 0, 0)"); - // expect(result4![1]).toEqual("255"); - // expect(result4![2]).toEqual("0"); + expect(result4!.length).toEqual(8); + expect(result4![0]).toEqual("rgb(255, 0, 0)"); + expect(result4![1]).toEqual("255"); + expect(result4![2]).toEqual("0"); const url = ''; const urlRegex = /^(\w+):\/\/([^\/?#]+)([^?#]*)(\?[^#]*)?(#.*)?$/; const match = url.match(urlRegex); - // expect(JSON.stringify(match)).toEqual("null"); - + expect(JSON.stringify(match)).toEqual("null"); + // #endif }) test('padEnd', () => { -- GitLab