Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
e515ac76
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1780
Star
33
Fork
10
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
5
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
5
Issue
5
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e515ac76
编写于
4月 01, 2025
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 屏蔽鸿蒙平台不支持的测试例
上级
cd3f691b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
5 deletion
+9
-5
uni_modules/uts-tests/utssdk/JSON.uts
uni_modules/uts-tests/utssdk/JSON.uts
+6
-2
uni_modules/uts-tests/utssdk/index.uts
uni_modules/uts-tests/utssdk/index.uts
+3
-3
未找到文件。
uni_modules/uts-tests/utssdk/JSON.uts
浏览文件 @
e515ac76
...
@@ -89,7 +89,7 @@ export function testJSON() : Result {
...
@@ -89,7 +89,7 @@ export function testJSON() : Result {
expect(JSON.stringify(new A3())).toEqual('"json"')
expect(JSON.stringify(new A3())).toEqual('"json"')
expect(JSON.stringify(new A4())).toEqual('null')
expect(JSON.stringify(new A4())).toEqual('null')
// #ifdef APP-ANDROID || APP-IOS
// #ifdef APP-ANDROID || APP-IOS
// js
平台toJSON不会递归
// js
引擎toJSON不会归调用
expect(JSON.stringify(new A5())!.length).toEqual(28)
expect(JSON.stringify(new A5())!.length).toEqual(28)
expect(JSON.stringify(new A6())!.length).toEqual(28)
expect(JSON.stringify(new A6())!.length).toEqual(28)
// #endif
// #endif
...
@@ -236,11 +236,13 @@ export function testJSON() : Result {
...
@@ -236,11 +236,13 @@ export function testJSON() : Result {
}`;
}`;
let obj3 = JSON.parseObject<UserJSON>(json2);
let obj3 = JSON.parseObject<UserJSON>(json2);
expect(obj3!.id).toEqual("30");
expect(obj3!.id).toEqual("30");
// #ifndef APP-HARMONY
const json3 = `{
const json3 = `{
"name": "John"
"name": "John"
}`;
}`;
let obj4 = JSON.parseObject<UserJSON>(json3);
let obj4 = JSON.parseObject<UserJSON>(json3);
expect(obj4).toEqual(null);
expect(obj4).toEqual(null);
// #endif
})
})
test('parseArray', () => {
test('parseArray', () => {
// #TEST JSON.parseArray
// #TEST JSON.parseArray
...
@@ -458,6 +460,7 @@ export function testJSON() : Result {
...
@@ -458,6 +460,7 @@ export function testJSON() : Result {
})
})
// #ifndef APP-HARMONY
test('invalidField', () => {
test('invalidField', () => {
let str = "{\"a+b\":\"test1\",\"a-b\":2,\"class\":true}"
let str = "{\"a+b\":\"test1\",\"a-b\":2,\"class\":true}"
let p = JSON.parseObject<PersonJSON>(str)
let p = JSON.parseObject<PersonJSON>(str)
...
@@ -468,6 +471,7 @@ export function testJSON() : Result {
...
@@ -468,6 +471,7 @@ export function testJSON() : Result {
let retStr = JSON.stringify(p)
let retStr = JSON.stringify(p)
console.log(retStr)
console.log(retStr)
})
})
// #endif
test('UTSJSONOject', () => {
test('UTSJSONOject', () => {
let t1 = "1"
let t1 = "1"
...
@@ -509,7 +513,7 @@ export function testJSON() : Result {
...
@@ -509,7 +513,7 @@ export function testJSON() : Result {
num : number,
num : number,
}
}
const map = JSON.parse<Map<string, A>>(`{"a": {"num": 1}}`)
const map = JSON.parse<Map<string, A>>(`{"a": {"num": 1}}`)
// #ifndef APP-IOS
// #ifndef APP-IOS
|| APP-HARMONY
expect(map instanceof Map).toEqual(true)
expect(map instanceof Map).toEqual(true)
// #endif
// #endif
expect(map?.get('a')?.num).toEqual(1)
expect(map?.get('a')?.num).toEqual(1)
...
...
uni_modules/uts-tests/utssdk/index.uts
浏览文件 @
e515ac76
...
@@ -15,7 +15,6 @@ import { testMath } from './Math.uts'
...
@@ -15,7 +15,6 @@ import { testMath } from './Math.uts'
import { testRegExp } from './RegExp.uts'
import { testRegExp } from './RegExp.uts'
import { testForLoop } from './ForLoop.uts'
import { testForLoop } from './ForLoop.uts'
import { testGlobal } from './Global.uts'
import { testGlobal } from './Global.uts'
import { testType } from './Type.uts'
export { Result } from './tests.uts'
export { Result } from './tests.uts'
import { testNativeCode } from './NativeCode.uts'
import { testNativeCode } from './NativeCode.uts'
import { testEncoder } from "./TextEncoder.uts"
import { testEncoder } from "./TextEncoder.uts"
...
@@ -27,6 +26,7 @@ import { testPromise } from "./Promise.uts"
...
@@ -27,6 +26,7 @@ import { testPromise } from "./Promise.uts"
import { testArrayBuffer } from './ArrayBuffer.uts'
import { testArrayBuffer } from './ArrayBuffer.uts'
// for of、for in在鸿蒙平台支持度欠佳,或许应该借助编译器拉齐?
// for of、for in在鸿蒙平台支持度欠佳,或许应该借助编译器拉齐?
import { testIterator } from "./iterator.uts"
import { testIterator } from "./iterator.uts"
import { testType } from './Type.uts'
// #endif
// #endif
import { testUTSXXX } from "./UTSXXX.uts"
import { testUTSXXX } from "./UTSXXX.uts"
...
@@ -45,7 +45,6 @@ export function runTests(): UTSJSONObject {
...
@@ -45,7 +45,6 @@ export function runTests(): UTSJSONObject {
const KeyWordRes = testKeyWord();
const KeyWordRes = testKeyWord();
const ForLoopRes = testForLoop();
const ForLoopRes = testForLoop();
const GlobalRes = testGlobal();
const GlobalRes = testGlobal();
const TypeRes = testType();
const JsonRes = testJSON();
const JsonRes = testJSON();
const JSONLargeRes = testJSONLarge();
const JSONLargeRes = testJSONLarge();
const UTSJSONObjectRes = testUTSJSONObject();
const UTSJSONObjectRes = testUTSJSONObject();
...
@@ -59,6 +58,7 @@ export function runTests(): UTSJSONObject {
...
@@ -59,6 +58,7 @@ export function runTests(): UTSJSONObject {
// #ifndef APP-HARMONY
// #ifndef APP-HARMONY
const ArrayBufferRes = testArrayBuffer();
const ArrayBufferRes = testArrayBuffer();
const IteratorRes = testIterator()
const IteratorRes = testIterator()
const TypeRes = testType();
// #endif
// #endif
const testUTSXXXRes = testUTSXXX()
const testUTSXXXRes = testUTSXXX()
return {
return {
...
@@ -75,7 +75,6 @@ export function runTests(): UTSJSONObject {
...
@@ -75,7 +75,6 @@ export function runTests(): UTSJSONObject {
KeyWord: KeyWordRes,
KeyWord: KeyWordRes,
ForLoop: ForLoopRes,
ForLoop: ForLoopRes,
Global: GlobalRes,
Global: GlobalRes,
Type: TypeRes,
console: consoleRes,
console: consoleRes,
Json: JsonRes,
Json: JsonRes,
JSONLarge: JSONLargeRes,
JSONLarge: JSONLargeRes,
...
@@ -89,6 +88,7 @@ export function runTests(): UTSJSONObject {
...
@@ -89,6 +88,7 @@ export function runTests(): UTSJSONObject {
// #ifndef APP-HARMONY
// #ifndef APP-HARMONY
ArrayBuffer: ArrayBufferRes,
ArrayBuffer: ArrayBufferRes,
Iterator: IteratorRes,
Iterator: IteratorRes,
Type: TypeRes,
// #endif
// #endif
UTSXXX: testUTSXXXRes,
UTSXXX: testUTSXXXRes,
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录