Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8d1b49cd
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8d1b49cd
编写于
1月 10, 2023
作者:
F
futurezhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bugfix for xts
Signed-off-by:
N
futurezhou
<
zhouweilai@huawei.com
>
上级
646aba9f
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
22 addition
and
29 deletion
+22
-29
storage/storagefileiojstest/src/main/js/test/FileIO.test.js
storage/storagefileiojstest/src/main/js/test/FileIO.test.js
+2
-2
storage/storagefileiojstest/src/main/js/test/module_fileio/class_stream/close.test.js
...src/main/js/test/module_fileio/class_stream/close.test.js
+4
-4
storage/storagefileiojstest/src/main/js/test/module_fileio/class_stream/flush.test.js
...src/main/js/test/module_fileio/class_stream/flush.test.js
+2
-2
storage/storagefileiojstest/src/main/js/test/module_fileio/members/createStream.test.js
...c/main/js/test/module_fileio/members/createStream.test.js
+2
-2
storage/storagefileiojstest/src/main/js/test/module_fileio/members/open.test.js
...stest/src/main/js/test/module_fileio/members/open.test.js
+0
-7
storage/storagefileiojstest/src/main/js/test/module_fileio/members/readtext.test.js
...t/src/main/js/test/module_fileio/members/readtext.test.js
+3
-3
storage/storagefileiojstest/src/main/js/test/module_fileio/members/rename.test.js
...est/src/main/js/test/module_fileio/members/rename.test.js
+3
-3
storage/storagefileiojstest/src/main/js/test/module_fileio/members/symlink.test.js
...st/src/main/js/test/module_fileio/members/symlink.test.js
+1
-1
storage/storagefileiojstest/src/main/js/test/module_fileio/members/write.test.js
...test/src/main/js/test/module_fileio/members/write.test.js
+5
-5
未找到文件。
storage/storagefileiojstest/src/main/js/test/FileIO.test.js
浏览文件 @
8d1b49cd
...
...
@@ -4054,7 +4054,7 @@ export default function fileIOTest() {
let
fpath
=
await
nextFileName
(
'
fileio_test_stat_promise_011
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
fileio
.
chmodSync
(
fpath
,
0o640
);
await
fileio
.
stat
(
fpath
).
then
((
stat
)
=>
{
fileio
.
stat
(
fpath
).
then
((
stat
)
=>
{
expect
((
stat
.
mode
&
0o777
)
==
0o640
).
assertTrue
();
fileio
.
unlinkSync
(
fpath
);
console
.
info
(
'
file stat Success
'
);
...
...
@@ -4314,7 +4314,7 @@ export default function fileIOTest() {
let
fpath
=
await
nextFileName
(
'
fileio_test_close_async_001
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
fd
=
fileio
.
openSync
(
fpath
);
await
fileio
.
close
(
fd
,
function
(
err
)
{
fileio
.
close
(
fd
,
function
(
err
)
{
fileio
.
unlinkSync
(
fpath
);
});
});
...
...
storage/storagefileiojstest/src/main/js/test/module_fileio/class_stream/close.test.js
浏览文件 @
8d1b49cd
...
...
@@ -84,8 +84,8 @@ describe('fileio_stream_close', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
fd
=
await
fileio
.
openSync
(
fpath
,
0o2
);
let
ss
=
await
fileio
.
fdopenStreamSync
(
fd
,
'
r+
'
);
let
fd
=
fileio
.
openSync
(
fpath
,
0o2
);
let
ss
=
fileio
.
fdopenStreamSync
(
fd
,
'
r+
'
);
expect
(
ss
!==
null
).
assertTrue
();
await
ss
.
close
();
fileio
.
unlinkSync
(
fpath
);
...
...
@@ -110,8 +110,8 @@ describe('fileio_stream_close', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
fd
=
await
fileio
.
openSync
(
fpath
,
0o2
);
let
ss
=
await
fileio
.
fdopenStreamSync
(
fd
,
'
r+
'
);
let
fd
=
fileio
.
openSync
(
fpath
,
0o2
);
let
ss
=
fileio
.
fdopenStreamSync
(
fd
,
'
r+
'
);
expect
(
ss
!==
null
).
assertTrue
();
ss
.
close
(
function
(
err
)
{
fileio
.
unlinkSync
(
fpath
);
...
...
storage/storagefileiojstest/src/main/js/test/module_fileio/class_stream/flush.test.js
浏览文件 @
8d1b49cd
...
...
@@ -87,7 +87,7 @@ describe('fileio_stream_flush', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
ss
=
await
fileio
.
createStreamSync
(
fpath
,
'
r+
'
);
let
ss
=
fileio
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
ss
!==
null
).
assertTrue
();
expect
(
ss
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
ss
.
flush
().
then
(
...
...
@@ -116,7 +116,7 @@ describe('fileio_stream_flush', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
ss
=
await
fileio
.
createStreamSync
(
fpath
,
'
r+
'
);
let
ss
=
fileio
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
ss
!==
null
).
assertTrue
();
expect
(
ss
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
ss
.
flush
(
function
(
err
)
{
...
...
storage/storagefileiojstest/src/main/js/test/module_fileio/members/createStream.test.js
浏览文件 @
8d1b49cd
...
...
@@ -61,7 +61,7 @@ describe('fileio_createStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
await
fileio
.
createStream
(
fpath
,
'
r+
'
,
function
(
err
,
stream
)
{
fileio
.
createStream
(
fpath
,
'
r+
'
,
function
(
err
,
stream
)
{
expect
(
stream
.
closeSync
()
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
done
();
...
...
@@ -86,7 +86,7 @@ describe('fileio_createStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
await
fileio
.
createStream
(
fpath
,
'
r+
'
,
function
(
err
,
stream
)
{
fileio
.
createStream
(
fpath
,
'
r+
'
,
function
(
err
,
stream
)
{
expect
(
stream
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
stream
.
closeSync
()
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
...
...
storage/storagefileiojstest/src/main/js/test/module_fileio/members/open.test.js
浏览文件 @
8d1b49cd
...
...
@@ -57,7 +57,6 @@ describe('fileio_open', function () {
fileio
.
open
(
fpath
,
0
,
0o0400
,
function
(
err
,
fd
)
{
fileio
.
read
(
fd
,
new
ArrayBuffer
(
4096
))
.
then
(
function
(
res
)
{
expect
((
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
res
.
buffer
)))
==
FILE_CONTENT
).
assertTrue
;
expect
(
res
.
bytesRead
==
FILE_CONTENT
.
length
).
assertTrue
();
fileio
.
closeSync
(
fd
);
fileio
.
unlinkSync
(
fpath
);
...
...
@@ -87,7 +86,6 @@ describe('fileio_open', function () {
await
fileio
.
open
(
fpath
,
0
,
0o0400
,
function
(
err
,
fd
)
{
fileio
.
read
(
fd
,
new
ArrayBuffer
(
4096
))
.
then
(
function
(
res
)
{
expect
((
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
res
.
buffer
)))
==
FILE_CONTENT
).
assertTrue
;
expect
(
res
.
bytesRead
==
FILE_CONTENT
.
length
).
assertTrue
();
fileio
.
closeSync
(
fd
);
fileio
.
unlinkSync
(
fpath
);
...
...
@@ -116,7 +114,6 @@ describe('fileio_open', function () {
await
fileio
.
open
(
fpath
,
0
,
function
(
err
,
fd
)
{
fileio
.
read
(
fd
,
new
ArrayBuffer
(
4096
))
.
then
(
function
(
res
)
{
expect
((
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
res
.
buffer
)))
==
FILE_CONTENT
).
assertTrue
;
expect
(
res
.
bytesRead
==
FILE_CONTENT
.
length
).
assertTrue
();
fileio
.
closeSync
(
fd
);
fileio
.
unlinkSync
(
fpath
);
...
...
@@ -145,7 +142,6 @@ describe('fileio_open', function () {
fileio
.
open
(
fpath
,
0o2
,
function
(
err
,
fd
)
{
fileio
.
read
(
fd
,
new
ArrayBuffer
(
4096
))
.
then
(
function
(
res
)
{
expect
((
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
res
.
buffer
)))
==
FILE_CONTENT
).
assertTrue
;
expect
(
res
.
bytesRead
==
FILE_CONTENT
.
length
).
assertTrue
();
fileio
.
closeSync
(
fd
);
fileio
.
unlinkSync
(
fpath
);
...
...
@@ -175,7 +171,6 @@ describe('fileio_open', function () {
.
then
(
function
(
fd
)
{
fileio
.
read
(
fd
,
new
ArrayBuffer
(
4096
))
.
then
(
function
(
res
)
{
expect
((
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
res
.
buffer
)))
==
FILE_CONTENT
).
assertTrue
;
expect
(
res
.
bytesRead
==
FILE_CONTENT
.
length
).
assertTrue
();
fileio
.
closeSync
(
fd
);
fileio
.
unlinkSync
(
fpath
);
...
...
@@ -207,7 +202,6 @@ describe('fileio_open', function () {
.
then
(
function
(
fd
)
{
fileio
.
read
(
fd
,
new
ArrayBuffer
(
4096
))
.
then
(
function
(
res
)
{
expect
((
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
res
.
buffer
)))
==
FILE_CONTENT
).
assertTrue
;
expect
(
res
.
bytesRead
==
FILE_CONTENT
.
length
).
assertTrue
();
fileio
.
closeSync
(
fd
);
fileio
.
unlinkSync
(
fpath
);
...
...
@@ -239,7 +233,6 @@ describe('fileio_open', function () {
.
then
(
function
(
fd
)
{
fileio
.
read
(
fd
,
new
ArrayBuffer
(
4096
))
.
then
(
function
(
res
)
{
expect
((
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
res
.
buffer
)))
==
FILE_CONTENT
).
assertTrue
;
expect
(
res
.
bytesRead
==
FILE_CONTENT
.
length
).
assertTrue
();
fileio
.
closeSync
(
fd
);
fileio
.
unlinkSync
(
fpath
);
...
...
storage/storagefileiojstest/src/main/js/test/module_fileio/members/readtext.test.js
浏览文件 @
8d1b49cd
...
...
@@ -171,7 +171,7 @@ describe('fileio_readtext', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
await
fileio
.
readText
(
fpath
,
{
position
:
pos
,
length
:
len
,
encoding
:
'
UTF-8
'
},
function
(
err
,
str
)
{
fileio
.
readText
(
fpath
,
{
position
:
pos
,
length
:
len
,
encoding
:
'
UTF-8
'
},
function
(
err
,
str
)
{
expect
(
str
==
FILE_CONTENT
.
substr
(
pos
,
len
)).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
done
();
...
...
@@ -198,7 +198,7 @@ describe('fileio_readtext', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
await
fileio
.
readText
(
fpath
,
{
position
:
1
},
function
(
err
,
str
)
{
fileio
.
readText
(
fpath
,
{
position
:
1
},
function
(
err
,
str
)
{
expect
(
str
==
FILE_CONTENT
.
substr
(
pos
,
len
)).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
done
();
...
...
@@ -225,7 +225,7 @@ describe('fileio_readtext', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
await
fileio
.
readText
(
fpath
,
{
position
:
1
},
function
(
err
,
str
)
{
fileio
.
readText
(
fpath
,
{
position
:
1
},
function
(
err
,
str
)
{
expect
(
str
==
FILE_CONTENT
.
substr
(
pos
,
len
)).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
});
...
...
storage/storagefileiojstest/src/main/js/test/module_fileio/members/rename.test.js
浏览文件 @
8d1b49cd
...
...
@@ -35,7 +35,7 @@ describe('fileio_rename', function () {
try
{
let
newf
=
fpath
+
'
123
'
;
await
fileio
.
rename
(
fpath
,
newf
)
fileio
.
rename
(
fpath
,
newf
)
.
then
(
function
(
err
)
{
expect
(
fileio
.
accessSync
(
newf
)
==
null
).
assertTrue
();
expect
(
err
==
null
).
assertTrue
();
...
...
@@ -65,7 +65,7 @@ describe('fileio_rename', function () {
try
{
let
newf
=
fpath
+
'
aaa
'
;
await
fileio
.
rename
(
fpath
,
newf
,
function
(
err
)
{
fileio
.
rename
(
fpath
,
newf
,
function
(
err
)
{
expect
(
fileio
.
accessSync
(
newf
)
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
newf
)
==
null
).
assertTrue
();
done
();
...
...
@@ -89,7 +89,7 @@ describe('fileio_rename', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
await
fileio
.
access
(
fpath
).
then
(
function
(
err
)
{
fileio
.
access
(
fpath
).
then
(
function
(
err
)
{
let
newf
=
fpath
+
'
123
'
;
fileio
.
rename
(
fpath
,
newf
)
.
then
(
function
(
err
)
{
...
...
storage/storagefileiojstest/src/main/js/test/module_fileio/members/symlink.test.js
浏览文件 @
8d1b49cd
...
...
@@ -86,7 +86,7 @@ describe('fileio_symlink', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
await
fileio
.
symlink
(
fpath
,
fpath
+
'
pass2
'
,
function
(
err
)
{
fileio
.
symlink
(
fpath
,
fpath
+
'
pass2
'
,
function
(
err
)
{
fileio
.
accessSync
(
fpath
+
'
pass2
'
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
unlinkSync
(
fpath
+
'
pass2
'
);
...
...
storage/storagefileiojstest/src/main/js/test/module_fileio/members/write.test.js
浏览文件 @
8d1b49cd
...
...
@@ -435,7 +435,7 @@ describe('fileio_write', function () {
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
expect
(
isIntNum
(
fd
)).
assertTrue
();
await
fileio
.
write
(
fd
,
new
ArrayBuffer
(
4096
),
function
(
fileio
.
write
(
fd
,
new
ArrayBuffer
(
4096
),
function
(
error
,
bytesWritten
)
{
...
...
@@ -465,7 +465,7 @@ describe('fileio_write', function () {
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
expect
(
isIntNum
(
fd
)).
assertTrue
();
await
fileio
.
write
(
fileio
.
write
(
fd
,
FILE_CONTENT
,
{
...
...
@@ -498,7 +498,7 @@ describe('fileio_write', function () {
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
expect
(
isIntNum
(
fd
)).
assertTrue
();
await
fileio
.
write
(
fileio
.
write
(
fd
,
FILE_CONTENT
,
{
...
...
@@ -532,7 +532,7 @@ describe('fileio_write', function () {
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
expect
(
isIntNum
(
fd
)).
assertTrue
();
await
fileio
.
write
(
fileio
.
write
(
fd
,
FILE_CONTENT
,
{
...
...
@@ -567,7 +567,7 @@ describe('fileio_write', function () {
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
expect
(
isIntNum
(
fd
)).
assertTrue
();
await
fileio
.
write
(
fileio
.
write
(
fd
,
FILE_CONTENT
,
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录