From ab639b9b9ef071d6e57b7625a1d18e96e3e72e5f Mon Sep 17 00:00:00 2001 From: duqingquan Date: Thu, 4 Jul 2024 11:03:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=A4=BA=E4=BE=8B=E4=B8=8D=E5=85=BC=E5=AE=B9web?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uts-tests/utssdk/Array.uts | 10 ++++++++-- uni_modules/uts-tests/utssdk/Date.uts | 17 ++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/uni_modules/uts-tests/utssdk/Array.uts b/uni_modules/uts-tests/utssdk/Array.uts index 3c0fcd1..5251a11 100644 --- a/uni_modules/uts-tests/utssdk/Array.uts +++ b/uni_modules/uts-tests/utssdk/Array.uts @@ -184,12 +184,18 @@ export function testArray(): Result { x : number y : number } - // #ifndef APP-IOS + // #ifdef WEB const s = JSON.parse(JSON.stringify([{ x: 0, y: 0 }])) as P[] s[0].x += 0; - const clearList = s.map((v : P, _, _) : number => v.x) + const clearList = s.map((v : P, _, a) : number => v.x) expect(clearList.includes(0)).toEqual(true); // #endif + // #ifdef APP-ANDROID + const s = JSON.parse(JSON.stringify([{ x: 0, y: 0 }])) as P[] + s[0].x += 0; + const clearList = s.map((v : P, _, _) : number => v.x) + expect(clearList.includes(0)).toEqual(true); + // #endif // #ifdef APP-IOS const s = JSON.parse(JSON.stringify([{ x: 0, y: 0 }])!) as P[] s[0].x += 0; diff --git a/uni_modules/uts-tests/utssdk/Date.uts b/uni_modules/uts-tests/utssdk/Date.uts index aa0b0a2..2a7c880 100644 --- a/uni_modules/uts-tests/utssdk/Date.uts +++ b/uni_modules/uts-tests/utssdk/Date.uts @@ -3,17 +3,24 @@ import { describe, test, expect, Result } from './tests.uts' export function testDate() : Result { return describe("Date", () => { test('now', () => { - UTSAndroid.getDispatcher("io").async(function(_){ + // #ifdef APP-ANDROID + UTSAndroid.getDispatcher("io").async(function(_){ + const start = Date.now() + setTimeout(() => { + const millis = Date.now() - start + const secondsElapsed = Math.floor(millis / 1000) + expect(secondsElapsed).toEqual(2); + }, 2000) + },null) + // #endif + // #ifndef APP-ANDROID const start = Date.now() setTimeout(() => { const millis = Date.now() - start - console.log("start",start) - console.log("millis",millis) - console.log("currentThread",Thread.currentThread().getName()) const secondsElapsed = Math.floor(millis / 1000) expect(secondsElapsed).toEqual(2); }, 2000) - },null) + // #endif }) test('new Date', () => { -- GitLab