Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0747a7ca
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看板
未验证
提交
0747a7ca
编写于
6月 14, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 14, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3549 update file testcase
Merge pull request !3549 from raoxian/cherry-pick-1655171785
上级
1b448192
b08e1ed4
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
493 addition
and
497 deletion
+493
-497
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
+17
-12
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/copyFile.test.js
...in/js/default/test/module_fileio/members/copyFile.test.js
+3
-5
storage/storagefilejstest/src/main/js/default/test/File.test.js
...e/storagefilejstest/src/main/js/default/test/File.test.js
+472
-476
未找到文件。
storage/storagefileiojstest/src/main/js/default/test/Common.js
浏览文件 @
0747a7ca
...
...
@@ -74,10 +74,7 @@ export function fileToWriteOnly(fpath) {
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
)
{
let
context
=
featureAbility
.
getContext
();
let
data
=
await
context
.
getCacheDir
();
...
...
storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/write.test.js
浏览文件 @
0747a7ca
...
...
@@ -36,16 +36,19 @@ describe('fileio_stream', function () {
try
{
let
ss
=
fileio
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
ss
!==
null
).
assertTrue
();
ss
.
write
(
new
ArrayBuffer
(
4096
),
{
let
length
=
4096
;
ss
.
write
(
new
ArrayBuffer
(
length
),
{
position
:
1
}).
then
(
function
(
len
)
{
expect
(
len
==
(
FILE_CONTENT
.
length
-
1
)).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
len
==
length
).
assertTrue
();
fileio
.
unlinkSync
(
fpath
);
ss
.
closeSync
();
done
();
})
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_stream_write_async_000 has failed for
'
+
e
);
}
catch
(
err
)
{
console
.
info
(
'
fileio_test_stream_write_async_000 has failed for
'
+
err
);
expect
(
null
).
assertFail
();
done
();
}
});
...
...
@@ -59,20 +62,22 @@ describe('fileio_stream', function () {
* @tc.require
*/
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
();
try
{
let
ss
=
fileio
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
ss
!==
null
).
assertTrue
();
ss
.
write
(
new
ArrayBuffer
(
4096
),
{
offset
:
1
,
encoding
:
'
utf-8
'
},
function
(
err
,
bytesWritten
)
{
expect
(
bytesWritten
==
(
FILE_CONTENT
.
length
-
1
)).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
bytesWritten
==
4095
).
assertTrue
();
fileio
.
unlinkSync
(
fpath
);
ss
.
closeSync
();
done
();
});
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_stream_write_async_001 has failed for
'
+
e
);
}
catch
(
err
)
{
console
.
info
(
'
fileio_test_stream_write_async_001 has failed for
'
+
err
);
expect
(
null
).
assertFail
();
done
();
}
});
});
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/copyFile.test.js
浏览文件 @
0747a7ca
...
...
@@ -169,14 +169,12 @@ describe('fileio_copyfile', function () {
fileio
.
copyFile
(
1
,
fpath
)
.
then
(
function
(
err
)
{
})
.
catch
(
function
(
e
)
{
expect
(
!!
e
).
assertTrue
();
fileio
.
unlinkSync
(
fpath
);
done
();
});
}
catch
(
e
)
{
expect
(
!!
e
).
assertTrue
(
);
done
();
console
.
log
(
'
fileio_copy_file_async_003 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
...
...
storage/storagefilejstest/src/main/js/default/test/File.test.js
浏览文件 @
0747a7ca
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录