提交 ab639b9b 编写于 作者: 杜庆泉's avatar 杜庆泉

修复部分测试示例不兼容web的问题

上级 9758fca0
...@@ -184,7 +184,13 @@ export function testArray(): Result { ...@@ -184,7 +184,13 @@ export function testArray(): Result {
x : number x : number
y : number y : number
} }
// #ifndef APP-IOS // #ifdef WEB
const s = JSON.parse<P[]>(JSON.stringify([{ x: 0, y: 0 }])) as P[]
s[0].x += 0;
const clearList = s.map((v : P, _, a) : number => v.x)
expect(clearList.includes(0)).toEqual(true);
// #endif
// #ifdef APP-ANDROID
const s = JSON.parse<P[]>(JSON.stringify([{ x: 0, y: 0 }])) as P[] const s = JSON.parse<P[]>(JSON.stringify([{ x: 0, y: 0 }])) as P[]
s[0].x += 0; s[0].x += 0;
const clearList = s.map((v : P, _, _) : number => v.x) const clearList = s.map((v : P, _, _) : number => v.x)
......
...@@ -3,17 +3,24 @@ import { describe, test, expect, Result } from './tests.uts' ...@@ -3,17 +3,24 @@ import { describe, test, expect, Result } from './tests.uts'
export function testDate() : Result { export function testDate() : Result {
return describe("Date", () => { return describe("Date", () => {
test('now', () => { test('now', () => {
// #ifdef APP-ANDROID
UTSAndroid.getDispatcher("io").async(function(_){ UTSAndroid.getDispatcher("io").async(function(_){
const start = Date.now() const start = Date.now()
setTimeout(() => { setTimeout(() => {
const millis = Date.now() - start 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) const secondsElapsed = Math.floor(millis / 1000)
expect(secondsElapsed).toEqual(2); expect(secondsElapsed).toEqual(2);
}, 2000) }, 2000)
},null) },null)
// #endif
// #ifndef APP-ANDROID
const start = Date.now()
setTimeout(() => {
const millis = Date.now() - start
const secondsElapsed = Math.floor(millis / 1000)
expect(secondsElapsed).toEqual(2);
}, 2000)
// #endif
}) })
test('new Date', () => { test('new Date', () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册