Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0db8dc7b
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看板
提交
0db8dc7b
编写于
5月 31, 2022
作者:
R
raoxian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update storagefileiojstest
Signed-off-by:
N
raoxian
<
raoxian@huawei.com
>
上级
9ffb8c36
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
375 addition
and
343 deletion
+375
-343
storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js
...oragefileiojstest/src/main/js/default/test/FileIO.test.js
+312
-281
storage/storagefileiojstest/src/main/js/default/test/FileIODir.test.js
...gefileiojstest/src/main/js/default/test/FileIODir.test.js
+43
-31
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/copyFile.test.js
...in/js/default/test/module_fileio/members/copyFile.test.js
+1
-0
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/createStream.test.js
...s/default/test/module_fileio/members/createStream.test.js
+3
-2
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fdatasync.test.js
...n/js/default/test/module_fileio/members/fdatasync.test.js
+1
-5
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/read.test.js
...c/main/js/default/test/module_fileio/members/read.test.js
+2
-9
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/symlink.test.js
...ain/js/default/test/module_fileio/members/symlink.test.js
+13
-15
未找到文件。
storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js
浏览文件 @
0db8dc7b
此差异已折叠。
点击以展开。
storage/storagefileiojstest/src/main/js/default/test/FileIODir.test.js
浏览文件 @
0db8dc7b
...
...
@@ -40,7 +40,7 @@ describe('fileIOTestDir', function () {
fileio
.
rmdirSync
(
dpath
);
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_open_sync_000 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_open_sync_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
...
...
@@ -56,7 +56,7 @@ describe('fileIOTestDir', function () {
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_open_sync_001 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_open_sync_001 has failed for
'
+
e
);
}
});
...
...
@@ -72,7 +72,7 @@ describe('fileIOTestDir', function () {
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_open_sync_002 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_open_sync_002 has failed for
'
+
e
);
expect
(
e
.
message
==
'
No such file or directory
'
).
assertTrue
();
}
});
...
...
@@ -87,14 +87,20 @@ describe('fileIOTestDir', function () {
fileio
.
mkdirSync
(
dpath
);
try
{
for
(
let
i
=
0
;
i
<
16
;
i
++
)
{
console
.
log
(
'
time
'
+
i
);
dpath
=
dpath
+
'
/
f
'
+
randomString
(
248
)
;
console
.
info
(
'
time
'
+
i
);
dpath
=
dpath
+
'
/
d
'
+
i
;
fileio
.
mkdirSync
(
dpath
);
}
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_open_sync_003 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_open_sync_003 has failed for
'
+
e
);
for
(
let
i
=
16
;
i
>=
0
;
i
--
)
{
if
(
i
<
16
)
{
dpath
=
dpath
.
replace
(
`/d
${
i
}
`
,
""
);
}
fileio
.
rmdirSync
(
dpath
);
}
}
});
...
...
@@ -110,7 +116,7 @@ describe('fileIOTestDir', function () {
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_open_sync_004 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_open_sync_004 has failed for
'
+
e
);
}
});
...
...
@@ -123,15 +129,21 @@ describe('fileIOTestDir', function () {
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_open_sync_005
'
);
fileio
.
mkdirSync
(
dpath
);
try
{
for
(
let
i
=
0
;
i
<
1
024
;
i
++
)
{
console
.
log
(
'
time
'
+
i
);
dpath
=
dpath
+
'
/
'
+
i
for
(
let
i
=
0
;
i
<
1
13
;
i
++
)
{
console
.
info
(
'
time
'
+
i
);
dpath
=
dpath
+
'
/
d
'
+
i
fileio
.
mkdirSync
(
dpath
);
}
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_open_sync_005 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_open_sync_005 has failed for
'
+
e
);
for
(
let
i
=
113
;
i
>=
0
;
i
--
)
{
if
(
i
<
113
)
{
dpath
=
dpath
.
replace
(
`/d
${
i
}
`
,
""
);
}
fileio
.
rmdirSync
(
dpath
);
}
}
});
...
...
@@ -147,7 +159,7 @@ describe('fileIOTestDir', function () {
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_open_sync_006 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_open_sync_006 has failed for
'
+
e
);
expect
(
e
.
message
==
'
No such file or directory
'
).
assertTrue
();
}
});
...
...
@@ -157,13 +169,13 @@ describe('fileIOTestDir', function () {
* @tc.name fileio_test_dir_open_async_001
* @tc.desc Function of API, file name contain special character.
*/
it
(
'
fileio_test_dir_open_async_001
'
,
0
,
async
function
()
{
it
(
'
fileio_test_dir_open_async_001
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_open_async_001
'
)
+
'
d
'
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
fileio
.
opendir
(
dpath
,
function
(
err
,
dir
)
{
expect
(
dir
!==
null
).
assertTrue
();
expect
(
dir
.
closeSync
()
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
dir
.
closeSync
();
fileio
.
rmdirSync
(
dpath
);
});
});
...
...
@@ -174,14 +186,14 @@ describe('fileIOTestDir', function () {
*/
it
(
'
fileio_test_dir_open_async_002
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_open_async_002
'
)
+
'
d
'
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
let
dir
=
await
fileio
.
opendir
(
dpath
).
then
((
)
=>
{
fileio
.
mkdirSync
(
dpath
);
fileio
.
opendir
(
dpath
).
then
((
dir
)
=>
{
expect
(
dir
!==
null
).
assertTrue
();
expect
(
dir
.
closeSync
()
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
console
.
log
(
'
fileio opendir Success
'
);
dir
.
closeSync
();
fileio
.
rmdirSync
(
dpath
);
console
.
info
(
'
fileio opendir Success
'
);
}).
catch
((
err
)
=>
{
console
.
log
(
"
fileio opendir err:
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
fileio opendir err:
"
+
JSON
.
stringify
(
err
));
});
});
...
...
@@ -204,7 +216,7 @@ describe('fileIOTestDir', function () {
fileio
.
rmdirSync
(
dpath
);
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_read_sync_000 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_read_sync_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
...
...
@@ -231,7 +243,7 @@ describe('fileIOTestDir', function () {
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
let
bool
=
typeof
(
dd
.
readSync
());
expect
(
bool
==
'
object
'
).
assertTrue
();
console
.
log
(
'
---bool=
'
+
bool
);
console
.
info
(
'
---bool=
'
+
bool
);
}
dd
.
closeSync
();
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
...
...
@@ -244,7 +256,7 @@ describe('fileIOTestDir', function () {
fileio
.
rmdirSync
(
dpath
);
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_read_sync_001 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_read_sync_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
...
...
@@ -283,7 +295,7 @@ describe('fileIOTestDir', function () {
fileio
.
rmdirSync
(
dpath
);
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_read_sync_002 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_read_sync_002 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
...
...
@@ -305,7 +317,7 @@ describe('fileIOTestDir', function () {
fileio
.
rmdirSync
(
dpath
);
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_read_sync_003 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_read_sync_003 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
...
...
@@ -328,7 +340,7 @@ describe('fileIOTestDir', function () {
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_read_sync_004 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_read_sync_004 has failed for
'
+
e
);
expect
(
e
.
message
==
'
Number of arguments unmatched
'
).
assertTrue
();
dd
.
closeSync
();
fileio
.
unlinkSync
(
fpath
);
...
...
@@ -359,7 +371,7 @@ describe('fileIOTestDir', function () {
fileio
.
rmdirSync
(
dpath
);
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_read_sync_005 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_read_sync_005 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
...
...
@@ -379,7 +391,7 @@ describe('fileIOTestDir', function () {
fileio
.
rmdirSync
(
dpath
);
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_close_sync_000 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_close_sync_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
...
...
@@ -399,7 +411,7 @@ describe('fileIOTestDir', function () {
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_close_sync_001 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_close_sync_001 has failed for
'
+
e
);
expect
(
e
.
message
==
'
Dir has been closed yet
'
).
assertTrue
();
fileio
.
rmdirSync
(
dpath
);
}
...
...
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/copyFile.test.js
浏览文件 @
0db8dc7b
...
...
@@ -170,6 +170,7 @@ describe('fileio_copyfile', function () {
fileio
.
copyFile
(
1
,
fpath
)
.
then
(
function
(
err
)
{
fileio
.
unlinkSync
(
fpath
);
done
();
})
}
catch
(
e
)
{
...
...
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/createStream.test.js
浏览文件 @
0db8dc7b
...
...
@@ -134,11 +134,12 @@ describe('fileio_createStream', function () {
try
{
fileio
.
createStream
(
fpath
,
'
ohos
'
,
function
(
err
)
{
fileio
.
unlinkSync
(
fpath
);
done
();
});
}
catch
(
e
)
{
expect
(
!!
e
).
assertTrue
(
);
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
console
.
info
(
"
fileio_test_stream_create_stream_async_004 has failed for
"
+
e
);
fileio
.
unlinkSync
(
fpath
);
done
();
}
});
...
...
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fdatasync.test.js
浏览文件 @
0db8dc7b
...
...
@@ -85,17 +85,13 @@ describe('fileio_fdatasync', async function () {
* @tc.require
*/
it
(
'
fileio_test_fdatasync_async_002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileio_test_fdatasync_async_002
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
fd
=
-
1
;
await
fileio
.
fdatasync
(
fd
);
expect
(
null
).
assertFail
();
done
()
}
catch
(
e
)
{
expect
(
!!
e
).
assertTrue
();
console
.
log
(
'
fileio_test_fdatasync_async_002 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_fdatasync_async_002 has failed for
'
+
e
);
done
();
}
});
...
...
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/read.test.js
浏览文件 @
0db8dc7b
...
...
@@ -508,18 +508,11 @@ describe('fileio_read', function () {
* @tc.require
*/
it
(
'
fileio_test_read_async_008
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileio_test_read_async_008
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
err
=
await
fileio
.
read
(
-
1
,
new
ArrayBuffer
(
4096
));
expect
(
!!
err
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
await
fileio
.
read
(
-
1
,
new
ArrayBuffer
(
4096
));
expect
(
null
).
assertFail
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_read_async_008 has failed for
'
+
e
);
expect
(
!!
e
).
assertTrue
();
console
.
info
(
'
fileio_test_read_async_008 has failed for
'
+
e
);
done
();
}
});
...
...
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/symlink.test.js
浏览文件 @
0db8dc7b
...
...
@@ -35,11 +35,11 @@ describe('fileio_symlink', function () {
try
{
fileio
.
symlinkSync
(
fpath
,
fpath
+
'
aaaa
'
);
expect
(
fileio
.
accessSync
(
fpath
+
'
aaaa
'
)
==
null
).
assertTrue
();
fileio
.
unlinkSync
(
fpath
+
'
aaaa
'
);
fileio
.
accessSync
(
fpath
+
'
aaaa
'
);
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_symlink_sync_000 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_symlink_sync_000 has failed for
'
+
e
);
fileio
.
unlinkSync
(
fpath
+
'
aaaa
'
);
}
});
...
...
@@ -58,18 +58,14 @@ describe('fileio_symlink', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
fileio
.
symlink
(
fpath
,
fpath
+
'
1067
'
)
.
then
(
function
(
err
)
{
expect
(
fileio
.
accessSync
(
fpath
+
'
1067
'
)
==
null
).
assertTrue
();
fileio
.
unlinkSync
(
fpath
+
'
1067
'
);
expect
(
err
==
null
).
assertTrue
();
})
.
catch
(
function
(
e
)
{
expect
(
e
==
null
).
assertTrue
();
});
fileio
.
symlink
(
fpath
,
fpath
+
'
1067
'
).
then
(
function
(
err
)
{
fileio
.
accessSync
(
fpath
+
'
1067
'
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
unlinkSync
(
fpath
+
'
1067
'
);
})
done
();
}
catch
(
e
)
{
console
.
info
(
'
fileio_test_symlink_async_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
...
...
@@ -85,16 +81,18 @@ describe('fileio_symlink', function () {
* @tc.require
*/
it
(
'
fileio_test_symlink_async_001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileio_test_symlink_async_0
10
'
);
let
fpath
=
await
nextFileName
(
'
fileio_test_symlink_async_0
01
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
await
fileio
.
symlink
(
fpath
,
fpath
+
'
pass2
'
,
function
(
err
)
{
expect
(
fileio
.
accessSync
(
fpath
+
'
pass2
'
)
==
null
).
assertTrue
();
fileio
.
accessSync
(
fpath
+
'
pass2
'
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
unlinkSync
(
fpath
+
'
pass2
'
);
done
();
});
}
catch
(
e
)
{
console
.
info
(
'
fileio_test_symlink_async_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录