Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
d5f82527
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看板
提交
d5f82527
编写于
5月 30, 2025
作者:
lizhongyi_
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增RegExp测试例
上级
fea17105
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
2 deletion
+23
-2
uni_modules/uts-tests/utssdk/RegExp.uts
uni_modules/uts-tests/utssdk/RegExp.uts
+23
-2
未找到文件。
uni_modules/uts-tests/utssdk/RegExp.uts
浏览文件 @
d5f82527
...
...
@@ -326,9 +326,7 @@ export function testRegExp(): Result {
// regex.lastIndex is now at 3
let a2 = regex8.test("foo"); // false
let b2 = regex8.lastIndex
// #ifdef APP-ANDROID
expect([a1, a2, b1, b2]).toEqual([true, false, 3, 0]);
// #endif
})
test('exec', () => {
...
...
@@ -410,6 +408,29 @@ export function testRegExp(): Result {
const pattern8 = /https:\/\/(?!\w+\.(com|net))\w+\.\w+/;
const result8 = pattern8.exec('https://example.org')!;
expect(result8[0]).toEqual('https://example.org');
// #ifdef APP-IOS
const str3 = 'abc="123123" src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png"'
let m : RegExpExecArray | null;
const attrReg = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
m = attrReg.exec(str3)
expect(m).toEqual([ 'abc="123123"', 'abc', '123123', '', '' ])
expect(attrReg.lastIndex).toEqual(12)
let i = 0
while(m != null) {
m = attrReg.exec(str3)
if (i == 0) {
expect(m).toEqual(['src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png"', "src", "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png", '', ''])
expect(attrReg.lastIndex).toEqual(78)
} else if (i == 1) {
expect(m).toEqual(null)
// expect(attrReg.lastIndex).toEqual(0)
}
i++;
}
// #endif
// #ifndef WEB
...
...
lizhongyi_
@m0_75226990
mentioned in commit
28a7147d
·
5月 30, 2025
mentioned in commit
28a7147d
mentioned in commit 28a7147d6a9159bff35e512fbdbd9daaa1ea67a6
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录