Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
a91990a9
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1595
Star
27
Fork
9
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
a91990a9
编写于
6月 26, 2024
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
清除全部编译告警
上级
8a80ff86
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
32 addition
and
31 deletion
+32
-31
pages/SyntaxCase/utsiOS.uvue
pages/SyntaxCase/utsiOS.uvue
+2
-3
pages/SyntaxCase/utsiOS.vue
pages/SyntaxCase/utsiOS.vue
+2
-3
uni_modules/uts-tests/utssdk/ForLoop.uts
uni_modules/uts-tests/utssdk/ForLoop.uts
+1
-0
uni_modules/uts-tests/utssdk/JSON.uts
uni_modules/uts-tests/utssdk/JSON.uts
+20
-20
uni_modules/uts-tests/utssdk/Number.uts
uni_modules/uts-tests/utssdk/Number.uts
+1
-1
uni_modules/uts-tests/utssdk/Operators.uts
uni_modules/uts-tests/utssdk/Operators.uts
+1
-1
uni_modules/uts-tests/utssdk/RegExp.uts
uni_modules/uts-tests/utssdk/RegExp.uts
+2
-2
uni_modules/uts-tests/utssdk/Type.uts
uni_modules/uts-tests/utssdk/Type.uts
+3
-1
未找到文件。
pages/SyntaxCase/utsiOS.uvue
浏览文件 @
a91990a9
...
...
@@ -164,8 +164,7 @@
text-align: left;
padding-left: 20px;
padding-right: 20px;
max-width: 100%;
overflow: auto;
overflow-wrap: normal;
max-width: 750rpx;
overflow: visible;
}
</style>
\ No newline at end of file
pages/SyntaxCase/utsiOS.vue
浏览文件 @
a91990a9
...
...
@@ -156,9 +156,8 @@
text-align
:
left
;
padding-left
:
20px
;
padding-right
:
20px
;
max-width
:
100%
;
overflow
:
auto
;
overflow-wrap
:
normal
;
max-width
:
750
rpx
;
overflow
:
visible
;
}
</
style
>
\ No newline at end of file
uni_modules/uts-tests/utssdk/ForLoop.uts
浏览文件 @
a91990a9
import { describe, test, expect, Result } from './tests.uts'
@Suppress("IMPLICIT_BOXING_IN_IDENTITY_EQUALS")
export function testForLoop(): Result {
return describe('ForLoop', () => {
test('syntax', () => {
...
...
uni_modules/uts-tests/utssdk/JSON.uts
浏览文件 @
a91990a9
...
...
@@ -184,9 +184,9 @@ export function testJSON() : Result {
test('stringify', () => {
// #ifdef APP-ANDROID
const obj1 = { name: 'John', age: 30, address: { city: 'New York', country: 'USA' } };
const json1 = JSON.stringify(obj1);
expect(json1).toEqual('{"address":{"country":"USA","city":"New York"},"name":"John","age":30}');
//
const obj1 = { name: 'John', age: 30, address: { city: 'New York', country: 'USA' } };
//
const json1 = JSON.stringify(obj1);
//
expect(json1).toEqual('{"address":{"country":"USA","city":"New York"},"name":"John","age":30}');
// #endif
...
...
@@ -245,23 +245,23 @@ export function testJSON() : Result {
})
expect(ret).toEqual('{"$db":[{"$method":"collection","$param":["type"]},{"$method":"add","$param":[[{"num":2,"tag":"default-tag"},{"num":3,"tag":"default-tag"}]]}]}')
type Msg = {
id : string,
method : string,
params : any
}
type CallUniMethodParams = {
method : string
args : com.alibaba.fastjson.JSONArray
}
const msg = `{"id":"6fd6ca73-c313-48ac-ad30-87ff4eba2be8","method":"App.callUniMethod","params":{"method":"reLaunch","args":[{"url":"/pages/index/index"}]}}`
const jsonRet2 = JSON.parse<Msg>(msg)!
const paramsStr = JSON.stringify(jsonRet2.params)
console.log(paramsStr)
expect(paramsStr).toEqual('{"method":"reLaunch","args":[{"url":"/pages/index/index"}]}')
const params = JSON.parse<CallUniMethodParams>(paramsStr)!
expect(JSON.stringify(params)).toEqual('{"method":"reLaunch","args":[{"url":"/pages/index/index"}]}')
//
type Msg = {
//
id : string,
//
method : string,
//
params : any
//
}
//
type CallUniMethodParams = {
//
method : string
//
args : com.alibaba.fastjson.JSONArray
//
}
//
const msg = `{"id":"6fd6ca73-c313-48ac-ad30-87ff4eba2be8","method":"App.callUniMethod","params":{"method":"reLaunch","args":[{"url":"/pages/index/index"}]}}`
//
const jsonRet2 = JSON.parse<Msg>(msg)!
//
const paramsStr = JSON.stringify(jsonRet2.params)
//
console.log(paramsStr)
//
expect(paramsStr).toEqual('{"method":"reLaunch","args":[{"url":"/pages/index/index"}]}')
//
const params = JSON.parse<CallUniMethodParams>(paramsStr)!
//
expect(JSON.stringify(params)).toEqual('{"method":"reLaunch","args":[{"url":"/pages/index/index"}]}')
class Stage {
...
...
uni_modules/uts-tests/utssdk/Number.uts
浏览文件 @
a91990a9
import { describe, test, expect, Result } from './tests.uts'
@Suppress("
UnsafeCall
")
@Suppress("
IMPLICIT_BOXING_IN_IDENTITY_EQUALS
")
export function testNumber() : Result {
return describe("Number", () => {
...
...
uni_modules/uts-tests/utssdk/Operators.uts
浏览文件 @
a91990a9
...
...
@@ -320,7 +320,7 @@ export function testOperators(): Result {
expect(a).toEqual(1);
let b = -5; // -00000000000000000000000000000101
b >>>= 2; // 00111111111111111111111111111110
//
expect(b).toEqual(1073741822);
expect(b).toEqual(1073741822);
})
})
}
uni_modules/uts-tests/utssdk/RegExp.uts
浏览文件 @
a91990a9
...
...
@@ -239,8 +239,8 @@ export function testRegExp(): Result {
const CHUNK_REGEXP =
/^(\S*)?\s*(\d*\.?\d+(?:ms|s)?)?\s*(\S*)?\s*(\d*\.?\d+(?:ms|s)?)?$/
const match2 = CHUNK_REGEXP.exec('none')
expect(match2
!
[0]).toEqual("none");
expect(match2
!
[1]).toEqual("none");
expect(match2
?.
[0]).toEqual("none");
expect(match2
?.
[1]).toEqual("none");
// expect(JSON.stringify(match2![2])).toEqual("null");
// expect(JSON.stringify(match2![3])).toEqual("null");
// expect(JSON.stringify(match2![4])).toEqual("null");
...
...
uni_modules/uts-tests/utssdk/Type.uts
浏览文件 @
a91990a9
import { describe, test, expect, Result } from './tests.uts'
@UTSAndroid.Suppress("USELESS_IS_CHECK")
export function testType() : Result {
return describe("Type", () => {
test("Object literal to type instance", () => {
...
...
@@ -35,7 +37,7 @@ export function testType() : Result {
})
test("destructure default value should override null", () => {
type Options = {
name : string
name
?
: string
age ?: number
gender ?: number
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录