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

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

上级 9758fca0
......@@ -184,12 +184,18 @@ export function testArray(): Result {
x : 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, _, _) : 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<P[]>(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<P[]>(JSON.stringify([{ x: 0, y: 0 }])!) as P[]
s[0].x += 0;
......
......@@ -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', () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册