Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
bdcdbd83
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看板
提交
bdcdbd83
编写于
6月 14, 2022
作者:
R
raoxian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update fileio testcase
Signed-off-by:
N
raoxian
<
raoxian@huawei.com
>
上级
d03b3c3e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
19 deletion
+12
-19
storage/storagefileiojstest/src/main/js/default/test/Common.js
...ge/storagefileiojstest/src/main/js/default/test/Common.js
+1
-4
storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/write.test.js
.../js/default/test/module_fileio/class_stream/write.test.js
+8
-6
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/copyFile.test.js
...in/js/default/test/module_fileio/members/copyFile.test.js
+3
-9
未找到文件。
storage/storagefileiojstest/src/main/js/default/test/Common.js
浏览文件 @
bdcdbd83
...
@@ -74,10 +74,7 @@ export function fileToWriteOnly(fpath) {
...
@@ -74,10 +74,7 @@ export function fileToWriteOnly(fpath) {
return
false
return
false
}
}
}
}
export
function
nextFileName1
(
testName
)
{
const
BASE_PATH
=
'
/data/accounts/account_0/appdata/ohos.acts.storage.fileio/cache/
'
return
BASE_PATH
+
testName
+
'
_
'
+
randomString
(
testName
.
length
);
}
export
async
function
nextFileName
(
testName
)
{
export
async
function
nextFileName
(
testName
)
{
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
let
data
=
await
context
.
getCacheDir
();
let
data
=
await
context
.
getCacheDir
();
...
...
storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/write.test.js
浏览文件 @
bdcdbd83
...
@@ -59,20 +59,22 @@ describe('fileio_stream', function () {
...
@@ -59,20 +59,22 @@ describe('fileio_stream', function () {
* @tc.require
* @tc.require
*/
*/
it
(
'
fileio_test_stream_write_async_001
'
,
0
,
async
function
(
done
)
{
it
(
'
fileio_test_stream_write_async_001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
nextFileName1
(
'
fileio_test_stream_write_async_001
'
);
let
fpath
=
await
nextFileName
(
'
fileio_test_stream_write_async_001
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
ss
=
fileio
.
createStreamSync
(
fpath
,
'
r+
'
);
let
ss
=
fileio
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
ss
!==
null
).
assertTrue
();
expect
(
ss
!==
null
).
assertTrue
();
ss
.
write
(
new
ArrayBuffer
(
4096
),
{
offset
:
1
,
encoding
:
'
utf-8
'
},
function
(
err
,
bytesWritten
)
{
ss
.
write
(
new
ArrayBuffer
(
4096
),
{
offset
:
1
,
encoding
:
'
utf-8
'
},
function
(
err
,
bytesWritten
)
{
expect
(
bytesWritten
==
(
FILE_CONTENT
.
length
-
1
)).
assertTrue
();
expect
(
bytesWritten
==
4095
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
fileio
.
unlinkSync
(
fpath
);
ss
.
closeSync
();
done
();
});
});
done
();
}
catch
(
err
)
{
}
catch
(
e
)
{
console
.
info
(
'
fileio_test_stream_write_async_001 has failed for
'
+
err
);
console
.
log
(
'
fileio_test_stream_write_async_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
done
();
}
}
});
});
});
});
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/copyFile.test.js
浏览文件 @
bdcdbd83
...
@@ -166,16 +166,10 @@ describe('fileio_copyfile', function () {
...
@@ -166,16 +166,10 @@ describe('fileio_copyfile', function () {
it
(
'
fileio_copy_file_async_003
'
,
0
,
async
function
(
done
)
{
it
(
'
fileio_copy_file_async_003
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileio_copy_file_async_003
'
);
let
fpath
=
await
nextFileName
(
'
fileio_copy_file_async_003
'
);
try
{
try
{
fileio
await
fileio
.
copyFile
(
1
,
fpath
);
.
copyFile
(
1
,
fpath
)
.
then
(
function
(
err
)
{
})
.
catch
(
function
(
e
)
{
expect
(
!!
e
).
assertTrue
();
done
();
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
!!
e
).
assertTrue
();
console
.
log
(
'
fileio_copy_file_async_003 has failed for
'
+
e
);
expect
(
e
.
message
==
"
Invalid argument
"
).
assertTrue
();
done
();
done
();
}
}
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录