Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
967b181c
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
967b181c
编写于
7月 28, 2022
作者:
R
raoxian
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改fileio dir.read()遍历到末尾读取异常问题
Signed-off-by:
N
raoxian
<
raoxian@huawei.com
>
上级
96b2eeb4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
70 addition
and
2 deletion
+70
-2
storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dir/read.test.js
...main/js/default/test/module_fileio/class_dir/read.test.js
+70
-2
未找到文件。
storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dir/read.test.js
浏览文件 @
967b181c
...
...
@@ -14,7 +14,7 @@
*/
import
{
fileio
,
FILE_CONTENT
,
prepareFile
,
nextFileName
,
isString
,
isBoolean
,
fileio
,
FILE_CONTENT
,
prepareFile
,
nextFileName
,
isString
,
isBoolean
,
forceRemoveDir
,
describe
,
it
,
expect
,
}
from
'
../../Common
'
;
...
...
@@ -190,6 +190,40 @@ describe('fileio_dir_read', function () {
}
});
/**
* @tc.number SUB_DF_FILEIO_DIR_READ_SYNC_NAME_0100
* @tc.name fileio_dir_read_sync_name_001
* @tc.desc Test Dir.readSync() interface. Synchronous loop reads next directory entry.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_sync_name_001
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_name_001
'
)
+
'
d
'
;
fileio
.
mkdirSync
(
dpath
);
let
fdpath
=
dpath
;
try
{
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
console
.
info
(
'
time
'
+
i
);
dpath
=
dpath
+
'
/d
'
+
i
;
fileio
.
mkdirSync
(
dpath
);
}
let
dir
=
fileio
.
opendirSync
(
fdpath
);
let
dirent
=
dir
.
readSync
();
while
(
dirent
)
{
fdpath
=
fdpath
+
'
/
'
+
dirent
.
name
;
dir
=
fileio
.
opendirSync
(
fdpath
);
dirent
=
dir
.
readSync
();
}
forceRemoveDir
(
dpath
,
10
);
}
catch
(
e
)
{
console
.
info
(
'
fileio_dir_read_sync_name_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FILEIO_DIR_READ_SYNC_ISBLOCKDEVICE_0000
* @tc.name fileio_dir_read_sync_isBlockDevice_000
...
...
@@ -413,7 +447,41 @@ describe('fileio_dir_read', function () {
}
});
/**
* @tc.number SUB_DF_FILEIO_DIR_READ_ASYNC_NAME_0100
* @tc.name fileio_dir_read_async_name_001
* @tc.desc Test Dir.readAsync() interface. Asynchronously loop to read next directory item.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_async_name_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_name_001
'
)
+
'
d
'
;
fileio
.
mkdirSync
(
dpath
);
let
fdpath
=
dpath
;
try
{
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
console
.
info
(
'
time
'
+
i
);
dpath
=
dpath
+
'
/d
'
+
i
;
fileio
.
mkdirSync
(
dpath
);
}
let
dir
=
fileio
.
opendirSync
(
fdpath
);
let
dirent
=
await
dir
.
read
();
while
(
dirent
)
{
fdpath
=
fdpath
+
'
/
'
+
dirent
.
name
;
dir
=
fileio
.
opendirSync
(
fdpath
);
dirent
=
await
dir
.
read
();
}
forceRemoveDir
(
dpath
,
10
);
done
();
}
catch
(
e
)
{
console
.
info
(
'
fileio_dir_read_async_name_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FILEIO_DIR_READ_ASYNC_ISBLOCKDEVICE_0000
* @tc.name fileio_dir_read_async_isBlockDevice_000
...
...
鸿蒙社区
@harmonycommunity
mentioned in commit
88d48ee7
·
9月 07, 2022
mentioned in commit
88d48ee7
mentioned in commit 88d48ee7bb005d3d880b99f891930671a54994ef
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录