Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0edfcc10
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,发现更多精彩内容 >>
提交
0edfcc10
编写于
2月 20, 2023
作者:
Z
zhuhongtao66
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改用例标签
Signed-off-by:
N
zhuhongtao66
<
zhuhongtao12@huawei.com
>
上级
c4fc77be
变更
24
展开全部
隐藏空白更改
内联
并排
Showing
24 changed file
with
2192 addition
and
2203 deletion
+2192
-2203
storage/storagefileiov9jstest/src/main/js/test/Common.js
storage/storagefileiov9jstest/src/main/js/test/Common.js
+3
-64
storage/storagefileiov9jstest/src/main/js/test/class_stream/close.test.js
...ileiov9jstest/src/main/js/test/class_stream/close.test.js
+31
-31
storage/storagefileiov9jstest/src/main/js/test/class_stream/flush.test.js
...ileiov9jstest/src/main/js/test/class_stream/flush.test.js
+29
-29
storage/storagefileiov9jstest/src/main/js/test/class_stream/read.test.js
...fileiov9jstest/src/main/js/test/class_stream/read.test.js
+111
-110
storage/storagefileiov9jstest/src/main/js/test/class_stream/write.test.js
...ileiov9jstest/src/main/js/test/class_stream/write.test.js
+145
-145
storage/storagefileiov9jstest/src/main/js/test/members/access.test.js
...agefileiov9jstest/src/main/js/test/members/access.test.js
+9
-9
storage/storagefileiov9jstest/src/main/js/test/members/close.test.js
...ragefileiov9jstest/src/main/js/test/members/close.test.js
+11
-12
storage/storagefileiov9jstest/src/main/js/test/members/createStream.test.js
...eiov9jstest/src/main/js/test/members/createStream.test.js
+78
-78
storage/storagefileiov9jstest/src/main/js/test/members/fdatasync.test.js
...fileiov9jstest/src/main/js/test/members/fdatasync.test.js
+32
-33
storage/storagefileiov9jstest/src/main/js/test/members/fdopenStream.test.js
...eiov9jstest/src/main/js/test/members/fdopenStream.test.js
+80
-80
storage/storagefileiov9jstest/src/main/js/test/members/fileLock.test.js
...efileiov9jstest/src/main/js/test/members/fileLock.test.js
+625
-626
storage/storagefileiov9jstest/src/main/js/test/members/fsync.test.js
...ragefileiov9jstest/src/main/js/test/members/fsync.test.js
+31
-32
storage/storagefileiov9jstest/src/main/js/test/members/listFile.test.js
...efileiov9jstest/src/main/js/test/members/listFile.test.js
+33
-33
storage/storagefileiov9jstest/src/main/js/test/members/lstat.test.js
...ragefileiov9jstest/src/main/js/test/members/lstat.test.js
+67
-67
storage/storagefileiov9jstest/src/main/js/test/members/mkdir.test.js
...ragefileiov9jstest/src/main/js/test/members/mkdir.test.js
+2
-2
storage/storagefileiov9jstest/src/main/js/test/members/moveFile.test.js
...efileiov9jstest/src/main/js/test/members/moveFile.test.js
+34
-34
storage/storagefileiov9jstest/src/main/js/test/members/open.test.js
...oragefileiov9jstest/src/main/js/test/members/open.test.js
+148
-149
storage/storagefileiov9jstest/src/main/js/test/members/read.test.js
...oragefileiov9jstest/src/main/js/test/members/read.test.js
+157
-163
storage/storagefileiov9jstest/src/main/js/test/members/rmdir.test.js
...ragefileiov9jstest/src/main/js/test/members/rmdir.test.js
+17
-17
storage/storagefileiov9jstest/src/main/js/test/members/stat.test.js
...oragefileiov9jstest/src/main/js/test/members/stat.test.js
+219
-219
storage/storagefileiov9jstest/src/main/js/test/members/symlink.test.js
...gefileiov9jstest/src/main/js/test/members/symlink.test.js
+13
-13
storage/storagefileiov9jstest/src/main/js/test/members/truncate.test.js
...efileiov9jstest/src/main/js/test/members/truncate.test.js
+106
-39
storage/storagefileiov9jstest/src/main/js/test/members/unlink.test.js
...agefileiov9jstest/src/main/js/test/members/unlink.test.js
+7
-8
storage/storagefileiov9jstest/src/main/js/test/members/write.test.js
...ragefileiov9jstest/src/main/js/test/members/write.test.js
+204
-210
未找到文件。
storage/storagefileiov9jstest/src/main/js/test/Common.js
浏览文件 @
0edfcc10
/*
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Copyright (C) 2022
-2023
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -13,7 +13,6 @@
...
@@ -13,7 +13,6 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
fileio
from
'
@ohos.fileio
'
;
import
fileIO
from
'
@ohos.file.fs
'
;
import
fileIO
from
'
@ohos.file.fs
'
;
import
util
from
'
@ohos.util
'
;
import
util
from
'
@ohos.util
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
...
@@ -30,8 +29,8 @@ export function prepareFile(fpath, content) {
...
@@ -30,8 +29,8 @@ export function prepareFile(fpath, content) {
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
CREATE
|
fileIO
.
OpenMode
.
READ_WRITE
)
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
CREATE
|
fileIO
.
OpenMode
.
READ_WRITE
)
fileIO
.
truncateSync
(
file
.
fd
)
fileIO
.
truncateSync
(
file
.
fd
)
fileIO
.
writeSync
(
file
.
fd
,
content
)
fileIO
.
writeSync
(
file
.
fd
,
content
)
file
io
.
fsyncSync
(
file
.
fd
)
file
IO
.
fsyncSync
(
file
.
fd
)
file
io
.
closeSync
(
file
.
fd
)
file
IO
.
closeSync
(
file
)
return
true
return
true
}
}
catch
(
e
)
{
catch
(
e
)
{
...
@@ -40,46 +39,6 @@ export function prepareFile(fpath, content) {
...
@@ -40,46 +39,6 @@ export function prepareFile(fpath, content) {
}
}
}
}
export
function
prepareEmptyFile
(
fpath
)
{
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
CREATE
|
fileIO
.
OpenMode
.
READ_WRITE
)
fileio
.
closeSync
(
file
.
fd
)
return
true
}
catch
(
e
)
{
console
.
log
(
'
Failed to prepareFile for
'
+
e
)
return
false
}
}
export
function
fileToReadOnly
(
fpath
)
{
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
CREATE
)
fileio
.
fchmodSync
(
file
.
fd
,
0o444
)
fileio
.
fsyncSync
(
file
.
fd
)
fileio
.
closeSync
(
file
.
fd
)
return
true
}
catch
(
e
)
{
console
.
log
(
'
Failed to fileToReadOnly for
'
+
e
);
return
false
}
}
export
function
fileToWriteOnly
(
fpath
)
{
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
CREATE
|
fileIO
.
OpenMode
.
WRITE_ONLY
)
fileio
.
fchmodSync
(
file
.
fd
,
0o222
)
fileio
.
fsyncSync
(
file
.
fd
)
fileio
.
closeSync
(
file
.
fd
)
return
true
}
catch
(
e
)
{
console
.
log
(
'
Failed to fileToWriteOnly
'
+
e
)
return
false
}
}
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
();
...
@@ -105,15 +64,6 @@ export function randomString(num) {
...
@@ -105,15 +64,6 @@ export function randomString(num) {
return
pwd
;
return
pwd
;
}
}
export
function
forceRemoveDir
(
path
,
num
)
{
for
(
let
i
=
num
;
i
>=
0
;
i
--
)
{
if
(
i
<
num
)
{
path
=
path
.
replace
(
`/d
${
i
}
`
,
""
);
}
fileio
.
rmdirSync
(
path
);
}
}
function
isIntNum
(
val
)
{
function
isIntNum
(
val
)
{
return
typeof
val
===
'
number
'
&&
val
%
1
===
0
;
return
typeof
val
===
'
number
'
&&
val
%
1
===
0
;
}
}
...
@@ -126,22 +76,11 @@ function isString(str) {
...
@@ -126,22 +76,11 @@ function isString(str) {
return
(
typeof
str
==
'
string
'
)
&&
str
.
constructor
==
String
;
return
(
typeof
str
==
'
string
'
)
&&
str
.
constructor
==
String
;
}
}
function
isBoolean
(
val
)
{
return
typeof
val
==
'
boolean
'
;
}
function
isInclude
(
error
,
message
)
{
return
error
.
toString
().
indexOf
(
message
)
!=
-
1
;
}
export
{
export
{
fileio
,
fileIO
,
fileIO
,
isIntNum
,
isIntNum
,
isBigInt
,
isBigInt
,
isString
,
isString
,
isBoolean
,
isInclude
,
describe
,
describe
,
it
,
it
,
expect
,
expect
,
...
...
storage/storagefileiov9jstest/src/main/js/test/class_stream/close.test.js
浏览文件 @
0edfcc10
...
@@ -21,7 +21,7 @@ export default function fileIOStreamClose() {
...
@@ -21,7 +21,7 @@ export default function fileIOStreamClose() {
describe
(
'
fileIO_fs_stream_close
'
,
function
()
{
describe
(
'
fileIO_fs_stream_close
'
,
function
()
{
/**
/**
* @tc.number SUB_DF_FILEIO_STREAM_CLOSESYNC_0000
* @tc.number SUB_DF_FILEIO_STREAM_CLOSE
_
SYNC_0000
* @tc.name fileIO_test_stream_close_sync_000
* @tc.name fileIO_test_stream_close_sync_000
* @tc.desc Test the closeSync() interface of class Stream.
* @tc.desc Test the closeSync() interface of class Stream.
* Open a file stream, close file stream.
* Open a file stream, close file stream.
...
@@ -35,9 +35,9 @@ describe('fileIO_fs_stream_close', function () {
...
@@ -35,9 +35,9 @@ describe('fileIO_fs_stream_close', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_stream_close_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_close_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -46,7 +46,7 @@ describe('fileIO_fs_stream_close', function () {
...
@@ -46,7 +46,7 @@ describe('fileIO_fs_stream_close', function () {
})
})
/**
/**
* @tc.number SUB_DF_FILEIO_STREAM_CLOSESYNC_0100
* @tc.number SUB_DF_FILEIO_STREAM_CLOSE
_
SYNC_0100
* @tc.name fileIO_test_stream_close_sync_001
* @tc.name fileIO_test_stream_close_sync_001
* @tc.desc Test the closeSync() interface of class Stream.
* @tc.desc Test the closeSync() interface of class Stream.
* Invalid parameter, don't requrie any parameters.
* Invalid parameter, don't requrie any parameters.
...
@@ -58,14 +58,14 @@ describe('fileIO_fs_stream_close', function () {
...
@@ -58,14 +58,14 @@ describe('fileIO_fs_stream_close', function () {
it
(
'
fileIO_test_stream_close_sync_001
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_stream_close_sync_001
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_close_sync_001
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_close_sync_001
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
try
{
try
{
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
s
s
.
closeSync
(
1
);
s
r
.
closeSync
(
1
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_stream_close_sync_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_close_sync_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
...
@@ -73,7 +73,7 @@ describe('fileIO_fs_stream_close', function () {
...
@@ -73,7 +73,7 @@ describe('fileIO_fs_stream_close', function () {
})
})
/**
/**
* @tc.number SUB_DF_FILEIO_STREAM_CLOSESYNC_0200
* @tc.number SUB_DF_FILEIO_STREAM_CLOSE
_
SYNC_0200
* @tc.name fileIO_test_stream_close_sync_002
* @tc.name fileIO_test_stream_close_sync_002
* @tc.desc Test the closeSync() interface of class Stream.
* @tc.desc Test the closeSync() interface of class Stream.
* The file stream has been closed.
* The file stream has been closed.
...
@@ -85,12 +85,12 @@ describe('fileIO_fs_stream_close', function () {
...
@@ -85,12 +85,12 @@ describe('fileIO_fs_stream_close', function () {
it
(
'
fileIO_test_stream_close_sync_002
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_stream_close_sync_002
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_close_sync_002
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_close_sync_002
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
try
{
try
{
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
s
s
.
closeSync
();
s
r
.
closeSync
();
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
...
@@ -100,7 +100,7 @@ describe('fileIO_fs_stream_close', function () {
...
@@ -100,7 +100,7 @@ describe('fileIO_fs_stream_close', function () {
})
})
/**
/**
* @tc.number SUB_DF_FILEIO_STREAM_CLOSEASYNC_0000
* @tc.number SUB_DF_FILEIO_STREAM_CLOSE
_
ASYNC_0000
* @tc.name fileIO_test_stream_close_async_000
* @tc.name fileIO_test_stream_close_async_000
* @tc.desc Test the close() interface of class Stream. Promise.
* @tc.desc Test the close() interface of class Stream. Promise.
* Open a file stream, close file stream.
* Open a file stream, close file stream.
...
@@ -114,9 +114,9 @@ describe('fileIO_fs_stream_close', function () {
...
@@ -114,9 +114,9 @@ describe('fileIO_fs_stream_close', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
await
s
s
.
close
();
await
s
r
.
close
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -126,7 +126,7 @@ describe('fileIO_fs_stream_close', function () {
...
@@ -126,7 +126,7 @@ describe('fileIO_fs_stream_close', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_STREAM_CLOSEASYNC_0100
* @tc.number SUB_DF_FILEIO_STREAM_CLOSE
_
ASYNC_0100
* @tc.name fileIO_test_stream_close_async_001
* @tc.name fileIO_test_stream_close_async_001
* @tc.desc Test the close() interface of class Stream. Callback.
* @tc.desc Test the close() interface of class Stream. Callback.
* Open a file stream, close file stream.
* Open a file stream, close file stream.
...
@@ -140,9 +140,9 @@ describe('fileIO_fs_stream_close', function () {
...
@@ -140,9 +140,9 @@ describe('fileIO_fs_stream_close', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
s
s
.
close
((
err
)
=>
{
s
r
.
close
((
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_stream_close_async_001 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_stream_close_async_001 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
...
@@ -157,7 +157,7 @@ describe('fileIO_fs_stream_close', function () {
...
@@ -157,7 +157,7 @@ describe('fileIO_fs_stream_close', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_STREAM_CLOSEASYNC_0200
* @tc.number SUB_DF_FILEIO_STREAM_CLOSE
_
ASYNC_0200
* @tc.name fileIO_test_stream_close_async_002
* @tc.name fileIO_test_stream_close_async_002
* @tc.desc Test the close() interface of class Stream. Promise.
* @tc.desc Test the close() interface of class Stream. Promise.
* The file stream has been closed.
* The file stream has been closed.
...
@@ -171,10 +171,10 @@ describe('fileIO_fs_stream_close', function () {
...
@@ -171,10 +171,10 @@ describe('fileIO_fs_stream_close', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
await
s
s
.
close
();
await
s
r
.
close
();
await
s
s
.
close
();
await
s
r
.
close
();
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
...
@@ -185,7 +185,7 @@ describe('fileIO_fs_stream_close', function () {
...
@@ -185,7 +185,7 @@ describe('fileIO_fs_stream_close', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_STREAM_CLOSEASYNC_0300
* @tc.number SUB_DF_FILEIO_STREAM_CLOSE
_
ASYNC_0300
* @tc.name fileIO_test_stream_close_async_003
* @tc.name fileIO_test_stream_close_async_003
* @tc.desc Test the close() interface of class Stream. Promise.
* @tc.desc Test the close() interface of class Stream. Promise.
* Invalid parameter, don't requrie any parameters.
* Invalid parameter, don't requrie any parameters.
...
@@ -199,9 +199,9 @@ describe('fileIO_fs_stream_close', function () {
...
@@ -199,9 +199,9 @@ describe('fileIO_fs_stream_close', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
await
s
s
.
close
(
1
);
await
s
r
.
close
(
1
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
...
...
storage/storagefileiov9jstest/src/main/js/test/class_stream/flush.test.js
浏览文件 @
0edfcc10
...
@@ -21,7 +21,7 @@ export default function fileIOStreamFlush() {
...
@@ -21,7 +21,7 @@ export default function fileIOStreamFlush() {
describe
(
'
fileIO_fs_stream_flush
'
,
function
()
{
describe
(
'
fileIO_fs_stream_flush
'
,
function
()
{
/**
/**
* @tc.number SUB_DF_FILEIO_STREAM_FLUSHSYNC_0000
* @tc.number SUB_DF_FILEIO_STREAM_FLUSH
_
SYNC_0000
* @tc.name fileIO_test_stream_flush_sync_000
* @tc.name fileIO_test_stream_flush_sync_000
* @tc.desc Test the flushSync() interface of class Stream.
* @tc.desc Test the flushSync() interface of class Stream.
* Refresh file stream.
* Refresh file stream.
...
@@ -35,11 +35,11 @@ describe('fileIO_fs_stream_flush', function () {
...
@@ -35,11 +35,11 @@ describe('fileIO_fs_stream_flush', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
r
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
flushSync
();
s
r
.
flushSync
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_stream_flush_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_flush_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -48,7 +48,7 @@ describe('fileIO_fs_stream_flush', function () {
...
@@ -48,7 +48,7 @@ describe('fileIO_fs_stream_flush', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_STREAM_FLUSHSYNC_0100
* @tc.number SUB_DF_FILEIO_STREAM_FLUSH
_
SYNC_0100
* @tc.name fileIO_test_stream_flush_sync_001
* @tc.name fileIO_test_stream_flush_sync_001
* @tc.desc Test the flushSync() interface of class Stream.
* @tc.desc Test the flushSync() interface of class Stream.
* Invalid parameter, don't requrie any parameters.
* Invalid parameter, don't requrie any parameters.
...
@@ -60,14 +60,14 @@ describe('fileIO_fs_stream_flush', function () {
...
@@ -60,14 +60,14 @@ describe('fileIO_fs_stream_flush', function () {
it
(
'
fileIO_test_stream_flush_sync_001
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_stream_flush_sync_001
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_flush_sync_001
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_flush_sync_001
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
try
{
try
{
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
s
s
.
flushSync
(
1
);
s
r
.
flushSync
(
1
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_stream_flush_sync_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_flush_sync_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
...
@@ -75,7 +75,7 @@ describe('fileIO_fs_stream_flush', function () {
...
@@ -75,7 +75,7 @@ describe('fileIO_fs_stream_flush', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_STREAM_FLUSHASYNC_0000
* @tc.number SUB_DF_FILEIO_STREAM_FLUSH
_
ASYNC_0000
* @tc.name fileIO_test_stream_flush_async_000
* @tc.name fileIO_test_stream_flush_async_000
* @tc.desc Test the flush() interface of class Stream. Promise.then().catch()
* @tc.desc Test the flush() interface of class Stream. Promise.then().catch()
* Refresh the file stream.
* Refresh the file stream.
...
@@ -89,11 +89,11 @@ describe('fileIO_fs_stream_flush', function () {
...
@@ -89,11 +89,11 @@ describe('fileIO_fs_stream_flush', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
await
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
await
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
r
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
flush
().
then
(()
=>
{
s
r
.
flush
().
then
(()
=>
{
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
...
@@ -107,7 +107,7 @@ describe('fileIO_fs_stream_flush', function () {
...
@@ -107,7 +107,7 @@ describe('fileIO_fs_stream_flush', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_STREAM_FLUSHASYNC_0100
* @tc.number SUB_DF_FILEIO_STREAM_FLUSH
_
ASYNC_0100
* @tc.name fileIO_test_stream_flush_async_001
* @tc.name fileIO_test_stream_flush_async_001
* @tc.desc Test the flush() interface of class Stream. Callback.
* @tc.desc Test the flush() interface of class Stream. Callback.
* Refresh the file stream.
* Refresh the file stream.
...
@@ -121,15 +121,15 @@ describe('fileIO_fs_stream_flush', function () {
...
@@ -121,15 +121,15 @@ describe('fileIO_fs_stream_flush', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
await
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
await
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
r
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
flush
((
err
)
=>
{
s
r
.
flush
((
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_stream_flush_async_001 error package
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_stream_flush_async_001 error package
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
})
})
...
@@ -140,7 +140,7 @@ describe('fileIO_fs_stream_flush', function () {
...
@@ -140,7 +140,7 @@ describe('fileIO_fs_stream_flush', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_STREAM_FLUSHASYNC_0100
* @tc.number SUB_DF_FILEIO_STREAM_FLUSH
_
ASYNC_0100
* @tc.name fileIO_test_stream_flush_async_001
* @tc.name fileIO_test_stream_flush_async_001
* @tc.desc Test the flush() interface of class Stream. Promise.
* @tc.desc Test the flush() interface of class Stream. Promise.
* Refresh the file stream.
* Refresh the file stream.
...
@@ -153,14 +153,14 @@ describe('fileIO_fs_stream_flush', function () {
...
@@ -153,14 +153,14 @@ describe('fileIO_fs_stream_flush', function () {
it
(
'
fileIO_test_stream_flush_sync_001
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_stream_flush_sync_001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_flush_sync_001
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_flush_sync_001
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
try
{
try
{
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
await
s
s
.
flush
(
1
);
await
s
r
.
flush
(
1
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_stream_flush_sync_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_flush_sync_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
...
...
storage/storagefileiov9jstest/src/main/js/test/class_stream/read.test.js
浏览文件 @
0edfcc10
...
@@ -35,11 +35,11 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -35,11 +35,11 @@ describe('fileIO_fs_stream_read', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
let
read
out
=
ss
.
readSync
(
new
ArrayBuffer
(
4096
));
let
read
Len
=
sr
.
readSync
(
new
ArrayBuffer
(
4096
));
expect
(
read
out
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
read
Len
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_stream_read_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_read_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -62,11 +62,11 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -62,11 +62,11 @@ describe('fileIO_fs_stream_read', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
let
read
out
=
ss
.
readSync
(
new
ArrayBuffer
(
4096
),
{
length
:
2
});
let
read
Len
=
sr
.
readSync
(
new
ArrayBuffer
(
4096
),
{
length
:
2
});
expect
(
read
out
==
2
).
assertTrue
();
expect
(
read
Len
==
2
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_stream_read_sync_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_read_sync_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -89,11 +89,11 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -89,11 +89,11 @@ describe('fileIO_fs_stream_read', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
let
read
out
=
ss
.
readSync
(
new
ArrayBuffer
(
4096
),
{
offset
:
2
});
let
read
Len
=
sr
.
readSync
(
new
ArrayBuffer
(
4096
),
{
offset
:
2
});
expect
(
read
out
==
FILE_CONTENT
.
length
-
2
).
assertTrue
();
expect
(
read
Len
==
FILE_CONTENT
.
length
-
2
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_stream_read_sync_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_read_sync_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -116,14 +116,14 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -116,14 +116,14 @@ describe('fileIO_fs_stream_read', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
let
read
out
=
ss
.
readSync
(
new
ArrayBuffer
(
4096
),
{
let
read
Len
=
sr
.
readSync
(
new
ArrayBuffer
(
4096
),
{
offset
:
1
,
offset
:
1
,
length
:
FILE_CONTENT
.
length
length
:
FILE_CONTENT
.
length
});
});
expect
(
read
out
==
FILE_CONTENT
.
length
-
1
).
assertTrue
();
expect
(
read
Len
==
FILE_CONTENT
.
length
-
1
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_stream_read_sync_003 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_read_sync_003 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -144,14 +144,14 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -144,14 +144,14 @@ describe('fileIO_fs_stream_read', function () {
it
(
'
fileIO_test_stream_read_sync_004
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_stream_read_sync_004
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_sync_004
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_sync_004
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
try
{
try
{
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
s
s
.
readSync
(
""
);
s
r
.
readSync
(
""
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_stream_read_sync_004 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_read_sync_004 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
...
@@ -171,15 +171,15 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -171,15 +171,15 @@ describe('fileIO_fs_stream_read', function () {
it
(
'
fileIO_test_stream_read_sync_005
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_stream_read_sync_005
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_sync_005
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_sync_005
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
ss
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
sr
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
const
invalidLength
=
4097
;
try
{
try
{
expect
(
ss
!==
null
).
assertTrue
();
expect
(
sr
!==
null
).
assertTrue
();
const
invalidLength
=
4097
;
sr
.
readSync
(
new
ArrayBuffer
(
4096
),
{
length
:
invalidLength
});
ss
.
readSync
(
new
ArrayBuffer
(
4096
),
{
length
:
invalidLength
});
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_stream_read_sync_005 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_read_sync_005 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
...
@@ -199,15 +199,15 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -199,15 +199,15 @@ describe('fileIO_fs_stream_read', function () {
it
(
'
fileIO_test_stream_read_sync_006
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_stream_read_sync_006
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_sync_006
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_sync_006
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
ss
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
sr
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
const
invalidOffset
=
-
1
;
try
{
try
{
expect
(
ss
!==
null
).
assertTrue
();
expect
(
sr
!==
null
).
assertTrue
();
const
invalidOffset
=
-
1
;
sr
.
readSync
(
new
ArrayBuffer
(
4096
),
{
offset
:
invalidOffset
});
ss
.
readSync
(
new
ArrayBuffer
(
4096
),
{
offset
:
invalidOffset
});
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_stream_read_sync_006 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_read_sync_006 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
...
@@ -229,11 +229,11 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -229,11 +229,11 @@ describe('fileIO_fs_stream_read', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
let
read
out
=
await
ss
.
read
(
new
ArrayBuffer
(
4096
));
let
read
Len
=
await
sr
.
read
(
new
ArrayBuffer
(
4096
));
expect
(
read
out
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
read
Len
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -257,15 +257,15 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -257,15 +257,15 @@ describe('fileIO_fs_stream_read', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
s
s
.
read
(
new
ArrayBuffer
(
4096
),
(
err
,
readout
)
=>
{
s
r
.
read
(
new
ArrayBuffer
(
4096
),
(
err
,
readLen
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_stream_read_async_001 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_stream_read_async_001 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
expect
(
read
out
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
read
Len
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
});
});
...
@@ -290,13 +290,13 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -290,13 +290,13 @@ describe('fileIO_fs_stream_read', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
let
read
out
=
await
ss
.
read
(
new
ArrayBuffer
(
4096
),
{
let
read
Len
=
await
sr
.
read
(
new
ArrayBuffer
(
4096
),
{
length
:
5
length
:
5
});
});
expect
(
read
out
==
5
).
assertTrue
();
expect
(
read
Len
==
5
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -320,17 +320,17 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -320,17 +320,17 @@ describe('fileIO_fs_stream_read', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
s
s
.
read
(
new
ArrayBuffer
(
4096
),
{
s
r
.
read
(
new
ArrayBuffer
(
4096
),
{
length
:
5
length
:
5
},
(
err
,
read
out
)
=>
{
},
(
err
,
read
Len
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_stream_read_async_003 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_stream_read_async_003 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
expect
(
read
out
==
5
).
assertTrue
();
expect
(
read
Len
==
5
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
});
});
...
@@ -355,13 +355,13 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -355,13 +355,13 @@ describe('fileIO_fs_stream_read', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
let
read
out
=
await
ss
.
read
(
new
ArrayBuffer
(
4096
),
{
let
read
Len
=
await
sr
.
read
(
new
ArrayBuffer
(
4096
),
{
offset
:
5
offset
:
5
});
});
expect
(
read
out
==
FILE_CONTENT
.
length
-
5
).
assertTrue
();
expect
(
read
Len
==
FILE_CONTENT
.
length
-
5
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -385,17 +385,17 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -385,17 +385,17 @@ describe('fileIO_fs_stream_read', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
s
s
.
read
(
new
ArrayBuffer
(
4096
),
{
s
r
.
read
(
new
ArrayBuffer
(
4096
),
{
offset
:
5
offset
:
5
},
(
err
,
read
out
)
=>
{
},
(
err
,
read
Len
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_stream_read_async_005 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_stream_read_async_005 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
expect
(
read
out
==
FILE_CONTENT
.
length
-
5
).
assertTrue
();
expect
(
read
Len
==
FILE_CONTENT
.
length
-
5
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
});
});
...
@@ -418,15 +418,15 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -418,15 +418,15 @@ describe('fileIO_fs_stream_read', function () {
it
(
'
fileIO_test_stream_read_async_006
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_stream_read_async_006
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_async_006
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_async_006
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
try
{
try
{
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
const
invalidLength
=
4097
;
const
invalidLength
=
4097
;
await
s
s
.
read
(
new
ArrayBuffer
(
4096
),
{
length
:
invalidLength
});
await
s
r
.
read
(
new
ArrayBuffer
(
4096
),
{
length
:
invalidLength
});
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_stream_read_async_006 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_read_async_006 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
...
@@ -447,18 +447,18 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -447,18 +447,18 @@ describe('fileIO_fs_stream_read', function () {
it
(
'
fileIO_test_stream_read_async_007
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_stream_read_async_007
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_async_007
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_async_007
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
try
{
try
{
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
const
invalidOffset
=
-
1
;
const
invalidOffset
=
-
1
;
s
s
.
read
(
new
ArrayBuffer
(
4096
),
{
s
r
.
read
(
new
ArrayBuffer
(
4096
),
{
offset
:
invalidOffset
offset
:
invalidOffset
},
(
err
)
=>
{
},
(
err
)
=>
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_stream_read_async_007 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_read_async_007 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
...
@@ -481,14 +481,14 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -481,14 +481,14 @@ describe('fileIO_fs_stream_read', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
let
read
out
=
await
ss
.
read
(
new
ArrayBuffer
(
4096
),
{
let
read
Len
=
await
sr
.
read
(
new
ArrayBuffer
(
4096
),
{
offset
:
1
,
offset
:
1
,
length
:
FILE_CONTENT
.
length
length
:
FILE_CONTENT
.
length
});
});
expect
(
read
out
==
FILE_CONTENT
.
length
-
1
).
assertTrue
();
expect
(
read
Len
==
FILE_CONTENT
.
length
-
1
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -512,18 +512,18 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -512,18 +512,18 @@ describe('fileIO_fs_stream_read', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
s
s
.
read
(
new
ArrayBuffer
(
4096
),
{
s
r
.
read
(
new
ArrayBuffer
(
4096
),
{
offset
:
1
,
offset
:
1
,
length
:
FILE_CONTENT
.
length
length
:
FILE_CONTENT
.
length
},
(
err
,
read
out
)
=>
{
},
(
err
,
read
Len
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_stream_read_async_009 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_stream_read_async_009 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
expect
(
read
out
==
FILE_CONTENT
.
length
-
1
).
assertTrue
();
expect
(
read
Len
==
FILE_CONTENT
.
length
-
1
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
});
});
...
@@ -548,11 +548,11 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -548,11 +548,11 @@ describe('fileIO_fs_stream_read', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
let
read
out
=
await
ss
.
read
(
new
ArrayBuffer
(
4096
),
{});
let
read
Len
=
await
sr
.
read
(
new
ArrayBuffer
(
4096
),
{});
expect
(
read
out
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
read
Len
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -576,16 +576,16 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -576,16 +576,16 @@ describe('fileIO_fs_stream_read', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
s
s
.
read
(
new
ArrayBuffer
(
4096
),
{
s
r
.
read
(
new
ArrayBuffer
(
4096
),
{
},
(
err
,
read
out
)
=>
{
},
(
err
,
read
Len
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_stream_read_async_011 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_stream_read_async_011 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
expect
(
read
out
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
read
Len
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
});
});
...
@@ -607,14 +607,14 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -607,14 +607,14 @@ describe('fileIO_fs_stream_read', function () {
it
(
'
fileIO_test_stream_read_async_012
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_stream_read_async_012
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_async_012
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_async_012
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
try
{
try
{
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
await
s
s
.
read
();
await
s
r
.
read
();
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_stream_read_async_012 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_read_async_012 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
...
@@ -635,13 +635,14 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -635,13 +635,14 @@ describe('fileIO_fs_stream_read', function () {
it
(
'
fileIO_test_stream_read_async_013
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_stream_read_async_013
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_async_013
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_async_013
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
ss
!==
null
).
assertTrue
();
try
{
try
{
await
ss
.
read
(
""
);
expect
(
sr
!==
null
).
assertTrue
();
await
sr
.
read
(
""
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_stream_read_async_013 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_read_async_013 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
...
@@ -662,15 +663,15 @@ describe('fileIO_fs_stream_read', function () {
...
@@ -662,15 +663,15 @@ describe('fileIO_fs_stream_read', function () {
it
(
'
fileIO_test_stream_read_async_014
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_stream_read_async_014
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_async_014
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_stream_read_async_014
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
try
{
try
{
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
s
s
.
read
(
""
,
(
err
)
=>
{
s
r
.
read
(
""
,
(
err
)
=>
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_stream_read_async_014 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_stream_read_async_014 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
...
...
storage/storagefileiov9jstest/src/main/js/test/class_stream/write.test.js
浏览文件 @
0edfcc10
此差异已折叠。
点击以展开。
storage/storagefileiov9jstest/src/main/js/test/members/access.test.js
浏览文件 @
0edfcc10
...
@@ -21,7 +21,7 @@ export default function fileIOAccess() {
...
@@ -21,7 +21,7 @@ export default function fileIOAccess() {
describe
(
'
fileIO_fs_access
'
,
function
()
{
describe
(
'
fileIO_fs_access
'
,
function
()
{
/**
/**
* @tc.number SUB_DF_FILEIO_ACCESSSYNC_0000
* @tc.number SUB_DF_FILEIO_ACCESS
_
SYNC_0000
* @tc.name fileIO_test_access_sync_000
* @tc.name fileIO_test_access_sync_000
* @tc.desc Test accessSync() interface.
* @tc.desc Test accessSync() interface.
* This interface shall work properly in normal case.
* This interface shall work properly in normal case.
...
@@ -49,7 +49,7 @@ describe('fileIO_fs_access', function () {
...
@@ -49,7 +49,7 @@ describe('fileIO_fs_access', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_ACCESSSYNC_0100
* @tc.number SUB_DF_FILEIO_ACCESS
_
SYNC_0100
* @tc.name fileIO_test_access_sync_001
* @tc.name fileIO_test_access_sync_001
* @tc.desc Test accessSync() interface.
* @tc.desc Test accessSync() interface.
* The test file is not exist.
* The test file is not exist.
...
@@ -71,7 +71,7 @@ describe('fileIO_fs_access', function () {
...
@@ -71,7 +71,7 @@ describe('fileIO_fs_access', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_ACCESSSYNC_0200
* @tc.number SUB_DF_FILEIO_ACCESS
_
SYNC_0200
* @tc.name fileIO_test_access_sync_002
* @tc.name fileIO_test_access_sync_002
* @tc.desc Test accessSync() interface.
* @tc.desc Test accessSync() interface.
* The test file path is illegal.
* The test file path is illegal.
...
@@ -92,7 +92,7 @@ describe('fileIO_fs_access', function () {
...
@@ -92,7 +92,7 @@ describe('fileIO_fs_access', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_ACCESSASYNC_0000
* @tc.number SUB_DF_FILEIO_ACCESS
_
ASYNC_0000
* @tc.name fileIO_test_access_async_000
* @tc.name fileIO_test_access_async_000
* @tc.desc Test access() interface. Promise.
* @tc.desc Test access() interface. Promise.
* Use promise to test that the file is exist. Sync method reads data from file.
* Use promise to test that the file is exist. Sync method reads data from file.
...
@@ -122,7 +122,7 @@ describe('fileIO_fs_access', function () {
...
@@ -122,7 +122,7 @@ describe('fileIO_fs_access', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_ACCESSASYNC_0100
* @tc.number SUB_DF_FILEIO_ACCESS
_
ASYNC_0100
* @tc.name fileIO_test_access_async_001
* @tc.name fileIO_test_access_async_001
* @tc.desc Test access() interface. Callback.
* @tc.desc Test access() interface. Callback.
* Use callback to test that the file is exist. Sync method reads data from file.
* Use callback to test that the file is exist. Sync method reads data from file.
...
@@ -157,7 +157,7 @@ describe('fileIO_fs_access', function () {
...
@@ -157,7 +157,7 @@ describe('fileIO_fs_access', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_ACCESSASYNC_0200
* @tc.number SUB_DF_FILEIO_ACCESS
_
ASYNC_0200
* @tc.name fileIO_test_access_async_002
* @tc.name fileIO_test_access_async_002
* @tc.desc Test access() interface. Promise.
* @tc.desc Test access() interface. Promise.
* Async test file does not exist.
* Async test file does not exist.
...
@@ -180,7 +180,7 @@ describe('fileIO_fs_access', function () {
...
@@ -180,7 +180,7 @@ describe('fileIO_fs_access', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_ACCESSASYNC_0300
* @tc.number SUB_DF_FILEIO_ACCESS
_
ASYNC_0300
* @tc.name fileIO_test_access_async_003
* @tc.name fileIO_test_access_async_003
* @tc.desc Test access() interface. Callback.
* @tc.desc Test access() interface. Callback.
* Async test file does not exist.
* Async test file does not exist.
...
@@ -208,7 +208,7 @@ describe('fileIO_fs_access', function () {
...
@@ -208,7 +208,7 @@ describe('fileIO_fs_access', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_ACCESSASYNC_0400
* @tc.number SUB_DF_FILEIO_ACCESS
_
ASYNC_0400
* @tc.name fileIO_test_access_async_004
* @tc.name fileIO_test_access_async_004
* @tc.desc Test access() interface. Promise.
* @tc.desc Test access() interface. Promise.
* Invalid path parameter.
* Invalid path parameter.
...
@@ -230,7 +230,7 @@ describe('fileIO_fs_access', function () {
...
@@ -230,7 +230,7 @@ describe('fileIO_fs_access', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_ACCESSASYNC_0500
* @tc.number SUB_DF_FILEIO_ACCESS
_
ASYNC_0500
* @tc.name fileIO_test_access_async_005
* @tc.name fileIO_test_access_async_005
* @tc.desc Test access() interface. Callback.
* @tc.desc Test access() interface. Callback.
* Invalid path parameter.
* Invalid path parameter.
...
...
storage/storagefileiov9jstest/src/main/js/test/members/close.test.js
浏览文件 @
0edfcc10
...
@@ -14,15 +14,14 @@
...
@@ -14,15 +14,14 @@
*/
*/
import
{
import
{
fileIO
,
FILE_CONTENT
,
nextFileName
,
prepareFile
,
fileIO
,
FILE_CONTENT
,
nextFileName
,
prepareFile
,
describe
,
it
,
expect
,
describe
,
it
,
expect
,
}
from
'
../Common
'
;
}
from
'
../Common
'
;
export
default
function
fileIOClose
()
{
export
default
function
fileIOClose
()
{
describe
(
'
fileIO_fs_close
'
,
function
()
{
describe
(
'
fileIO_fs_close
'
,
function
()
{
/**
/**
* @tc.number SUB_DF_FILEIO_CLOSESYNC_0000
* @tc.number SUB_DF_FILEIO_CLOSE
_
SYNC_0000
* @tc.name fileIO_test_close_sync_000
* @tc.name fileIO_test_close_sync_000
* @tc.desc Test closeSync() interfaces.
* @tc.desc Test closeSync() interfaces.
* Open file and close file by fd.
* Open file and close file by fd.
...
@@ -45,7 +44,7 @@ describe('fileIO_fs_close', function () {
...
@@ -45,7 +44,7 @@ describe('fileIO_fs_close', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_CLOSESYNC_0100
* @tc.number SUB_DF_FILEIO_CLOSE
_
SYNC_0100
* @tc.name fileIO_test_close_sync_001
* @tc.name fileIO_test_close_sync_001
* @tc.desc Test closeSync() interfaces.
* @tc.desc Test closeSync() interfaces.
* Open file and close file by file object.
* Open file and close file by file object.
...
@@ -68,7 +67,7 @@ describe('fileIO_fs_close', function () {
...
@@ -68,7 +67,7 @@ describe('fileIO_fs_close', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_CLOSESYNC_0200
* @tc.number SUB_DF_FILEIO_CLOSE
_
SYNC_0200
* @tc.name fileIO_test_close_sync_002
* @tc.name fileIO_test_close_sync_002
* @tc.desc Test closeSync() interfaces.
* @tc.desc Test closeSync() interfaces.
* Test fd has been closed.
* Test fd has been closed.
...
@@ -94,7 +93,7 @@ describe('fileIO_fs_close', function () {
...
@@ -94,7 +93,7 @@ describe('fileIO_fs_close', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_CLOSESYNC_0300
* @tc.number SUB_DF_FILEIO_CLOSE
_
SYNC_0300
* @tc.name fileIO_test_close_sync_003
* @tc.name fileIO_test_close_sync_003
* @tc.desc Test closeSync() interfaces.
* @tc.desc Test closeSync() interfaces.
* Test file has been closed.
* Test file has been closed.
...
@@ -120,7 +119,7 @@ describe('fileIO_fs_close', function () {
...
@@ -120,7 +119,7 @@ describe('fileIO_fs_close', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_CLOSESYNC_0400
* @tc.number SUB_DF_FILEIO_CLOSE
_
SYNC_0400
* @tc.name fileIO_test_close_sync_004
* @tc.name fileIO_test_close_sync_004
* @tc.desc Test closeSync() interfaces.
* @tc.desc Test closeSync() interfaces.
* No parameters.
* No parameters.
...
@@ -141,7 +140,7 @@ describe('fileIO_fs_close', function () {
...
@@ -141,7 +140,7 @@ describe('fileIO_fs_close', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_CLOSESYNC_0500
* @tc.number SUB_DF_FILEIO_CLOSE
_
SYNC_0500
* @tc.name fileIO_test_close_sync_005
* @tc.name fileIO_test_close_sync_005
* @tc.desc Test closeSync() interfaces.
* @tc.desc Test closeSync() interfaces.
* Illegal type of parameter.
* Illegal type of parameter.
...
@@ -301,7 +300,7 @@ describe('fileIO_fs_close', function () {
...
@@ -301,7 +300,7 @@ describe('fileIO_fs_close', function () {
/**
/**
* @tc.number SUB_DF_FILEIO_CLOSE_ASYNC_0500
* @tc.number SUB_DF_FILEIO_CLOSE_ASYNC_0500
* @tc.name fileIO_test_close_async_005
* @tc.name fileIO_test_close_async_005
* @tc.desc Test close() interfaces. Promise.
* @tc.desc Test close() interfaces. Promise.
* Test file has been closed.
* Test file has been closed.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
...
@@ -315,12 +314,12 @@ describe('fileIO_fs_close', function () {
...
@@ -315,12 +314,12 @@ describe('fileIO_fs_close', function () {
try
{
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
await
fileIO
.
close
(
file
);
await
fileIO
.
close
(
file
);
fileIO
.
close
(
file
);
await
fileIO
.
close
(
file
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_close_async_005 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_close_async_005 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
}
}
});
});
...
@@ -335,7 +334,7 @@ describe('fileIO_fs_close', function () {
...
@@ -335,7 +334,7 @@ describe('fileIO_fs_close', function () {
* @tc.level Level 3
* @tc.level Level 3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_close_async_006
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_close_async_006
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_close_async_006
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_close_async_006
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
...
...
storage/storagefileiov9jstest/src/main/js/test/members/createStream.test.js
浏览文件 @
0edfcc10
...
@@ -33,15 +33,15 @@ describe('fileIO_fs_createStream', function () {
...
@@ -33,15 +33,15 @@ describe('fileIO_fs_createStream', function () {
it
(
'
fileIO_test_create_stream_sync_000
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_create_stream_sync_000
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_create_stream_sync_000
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_create_stream_sync_000
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
try
{
try
{
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
expect
(
s
s
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
writeSync
(
FILE_CONTENT
);
s
r
.
writeSync
(
FILE_CONTENT
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_create_stream_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_create_stream_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
...
@@ -85,11 +85,11 @@ describe('fileIO_fs_createStream', function () {
...
@@ -85,11 +85,11 @@ describe('fileIO_fs_createStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
let
s
r
=
fileIO
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
expect
(
s
s
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
r
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_create_stream_sync_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_create_stream_sync_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -263,11 +263,11 @@ describe('fileIO_fs_createStream', function () {
...
@@ -263,11 +263,11 @@ describe('fileIO_fs_createStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
w+
'
);
let
s
w
=
fileIO
.
createStreamSync
(
fpath
,
'
w+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
w
!==
null
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
w
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
s
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
w
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
w
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_create_stream_sync_009 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_create_stream_sync_009 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -289,11 +289,11 @@ describe('fileIO_fs_createStream', function () {
...
@@ -289,11 +289,11 @@ describe('fileIO_fs_createStream', function () {
let
fpath
=
await
nextFileName
(
'
fileIO_test_create_stream_sync_010
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_create_stream_sync_010
'
);
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
w+
'
);
let
s
w
=
fileIO
.
createStreamSync
(
fpath
,
'
w+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
w
!==
null
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
w
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
s
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
w
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
w
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_create_stream_sync_010 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_create_stream_sync_010 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -316,10 +316,10 @@ describe('fileIO_fs_createStream', function () {
...
@@ -316,10 +316,10 @@ describe('fileIO_fs_createStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
a
'
);
let
s
a
=
fileIO
.
createStreamSync
(
fpath
,
'
a
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
a
!==
null
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
a
.
closeSync
();
let
sr
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
let
sr
=
fileIO
.
createStreamSync
(
fpath
,
'
r
'
);
expect
(
sr
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
expect
(
sr
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
...
@@ -345,10 +345,10 @@ describe('fileIO_fs_createStream', function () {
...
@@ -345,10 +345,10 @@ describe('fileIO_fs_createStream', function () {
let
fpath
=
await
nextFileName
(
'
fileIO_test_create_stream_sync_012
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_create_stream_sync_012
'
);
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
a
'
);
let
s
a
=
fileIO
.
createStreamSync
(
fpath
,
'
a
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
a
!==
null
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
a
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_create_stream_sync_012 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_create_stream_sync_012 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -369,15 +369,15 @@ describe('fileIO_fs_createStream', function () {
...
@@ -369,15 +369,15 @@ describe('fileIO_fs_createStream', function () {
it
(
'
fileIO_test_create_stream_sync_013
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_create_stream_sync_013
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_create_stream_sync_013
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_create_stream_sync_013
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
a
'
);
let
s
a
=
fileIO
.
createStreamSync
(
fpath
,
'
a
'
);
try
{
try
{
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
a
!==
null
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
readSync
(
new
ArrayBuffer
(
4096
));
s
a
.
readSync
(
new
ArrayBuffer
(
4096
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
s
s
.
closeSync
();
s
a
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_create_stream_sync_013 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_create_stream_sync_013 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
...
@@ -399,11 +399,11 @@ describe('fileIO_fs_createStream', function () {
...
@@ -399,11 +399,11 @@ describe('fileIO_fs_createStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
a+
'
);
let
s
a
=
fileIO
.
createStreamSync
(
fpath
,
'
a+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
a
!==
null
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
s
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
expect
(
s
a
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
s
s
.
closeSync
();
s
a
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_create_stream_sync_014 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_create_stream_sync_014 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -425,11 +425,11 @@ describe('fileIO_fs_createStream', function () {
...
@@ -425,11 +425,11 @@ describe('fileIO_fs_createStream', function () {
let
fpath
=
await
nextFileName
(
'
fileIO_test_create_stream_sync_015
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_create_stream_sync_015
'
);
try
{
try
{
let
s
s
=
fileIO
.
createStreamSync
(
fpath
,
'
a+
'
);
let
s
a
=
fileIO
.
createStreamSync
(
fpath
,
'
a+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
a
!==
null
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
s
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
a
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
a
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_create_stream_sync_015 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_create_stream_sync_015 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -450,15 +450,15 @@ describe('fileIO_fs_createStream', function () {
...
@@ -450,15 +450,15 @@ describe('fileIO_fs_createStream', function () {
it
(
'
fileIO_test_create_stream_async_000
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_create_stream_async_000
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_create_stream_async_000
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_create_stream_async_000
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
s
s
=
await
fileIO
.
createStream
(
fpath
,
'
r
'
);
let
s
r
=
await
fileIO
.
createStream
(
fpath
,
'
r
'
);
try
{
try
{
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
expect
(
s
s
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
writeSync
(
FILE_CONTENT
);
s
r
.
writeSync
(
FILE_CONTENT
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_create_stream_async_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_create_stream_async_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
...
@@ -481,16 +481,16 @@ describe('fileIO_fs_createStream', function () {
...
@@ -481,16 +481,16 @@ describe('fileIO_fs_createStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
fileIO
.
createStream
(
fpath
,
'
r
'
,
(
err
,
s
s
)
=>
{
fileIO
.
createStream
(
fpath
,
'
r
'
,
(
err
,
s
r
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_create_stream_async_001 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_create_stream_async_001 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
expect
(
s
s
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
write
(
FILE_CONTENT
,
(
err
)
=>
{
s
r
.
write
(
FILE_CONTENT
,
(
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
console
.
log
(
'
fileIO_test_create_stream_async_001 error: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
'
fileIO_test_create_stream_async_001 error: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
...
@@ -573,11 +573,11 @@ describe('fileIO_fs_createStream', function () {
...
@@ -573,11 +573,11 @@ describe('fileIO_fs_createStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
await
fileIO
.
createStream
(
fpath
,
'
r+
'
);
let
s
r
=
await
fileIO
.
createStream
(
fpath
,
'
r+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
expect
(
s
s
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
r
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -601,15 +601,15 @@ describe('fileIO_fs_createStream', function () {
...
@@ -601,15 +601,15 @@ describe('fileIO_fs_createStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
fileIO
.
createStream
(
fpath
,
'
r+
'
,
(
err
,
s
s
)
=>
{
fileIO
.
createStream
(
fpath
,
'
r+
'
,
(
err
,
s
r
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_create_stream_async_005 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_create_stream_async_005 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
r
!==
null
).
assertTrue
();
expect
(
s
s
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
r
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
});
});
...
@@ -829,11 +829,11 @@ describe('fileIO_fs_createStream', function () {
...
@@ -829,11 +829,11 @@ describe('fileIO_fs_createStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
s
s
=
await
fileIO
.
createStream
(
fpath
,
'
w+
'
);
let
s
w
=
await
fileIO
.
createStream
(
fpath
,
'
w+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
w
!==
null
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
w
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
s
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
w
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
w
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -856,11 +856,11 @@ describe('fileIO_fs_createStream', function () {
...
@@ -856,11 +856,11 @@ describe('fileIO_fs_createStream', function () {
let
fpath
=
await
nextFileName
(
'
fileIO_test_create_stream_async_014
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_create_stream_async_014
'
);
try
{
try
{
let
s
s
=
await
fileIO
.
createStream
(
fpath
,
'
w+
'
);
let
s
w
=
await
fileIO
.
createStream
(
fpath
,
'
w+
'
);
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
w
!==
null
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
w
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
s
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
w
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
w
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -884,15 +884,15 @@ describe('fileIO_fs_createStream', function () {
...
@@ -884,15 +884,15 @@ describe('fileIO_fs_createStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
fileIO
.
createStream
(
fpath
,
'
w+
'
,
(
err
,
s
s
)
=>
{
fileIO
.
createStream
(
fpath
,
'
w+
'
,
(
err
,
s
w
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_create_stream_async_015 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_create_stream_async_015 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
expect
(
s
s
!==
null
).
assertTrue
();
expect
(
s
w
!==
null
).
assertTrue
();
expect
(
s
s
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
w
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
s
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
w
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
s
s
.
closeSync
();
s
w
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
});
});
...
...
storage/storagefileiov9jstest/src/main/js/test/members/fdatasync.test.js
浏览文件 @
0edfcc10
...
@@ -14,8 +14,7 @@
...
@@ -14,8 +14,7 @@
*/
*/
import
{
import
{
fileio
,
fileIO
,
FILE_CONTENT
,
prepareFile
,
nextFileName
,
fileIO
,
FILE_CONTENT
,
prepareFile
,
nextFileName
,
describe
,
it
,
expect
,
describe
,
it
,
expect
,
}
from
'
../Common
'
;
}
from
'
../Common
'
;
export
default
function
fileIOFdatasync
()
{
export
default
function
fileIOFdatasync
()
{
...
@@ -38,8 +37,8 @@ export default function fileIOFdatasync() {
...
@@ -38,8 +37,8 @@ export default function fileIOFdatasync() {
try
{
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
fileIO
.
fdatasyncSync
(
file
.
fd
);
fileIO
.
fdatasyncSync
(
file
.
fd
);
file
io
.
closeSync
(
file
.
fd
);
file
IO
.
closeSync
(
file
);
file
io
.
unlinkSync
(
fpath
);
file
IO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_fdatasync_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_fdatasync_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
...
@@ -47,12 +46,12 @@ export default function fileIOFdatasync() {
...
@@ -47,12 +46,12 @@ export default function fileIOFdatasync() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FDATASYNC_SYNC_0
01
0
* @tc.number SUB_DF_FILEIO_FDATASYNC_SYNC_0
10
0
* @tc.name fileIO_test_fdatasync_sync_001
* @tc.name fileIO_test_fdatasync_sync_001
* @tc.desc Test fdatasyncSync() interfaces. Invalid fd parameter.
* @tc.desc Test fdatasyncSync() interfaces. Invalid fd parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fdatasync_sync_001
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_fdatasync_sync_001
'
,
0
,
async
function
()
{
...
@@ -67,12 +66,12 @@ export default function fileIOFdatasync() {
...
@@ -67,12 +66,12 @@ export default function fileIOFdatasync() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FDATASYNC_SYNC_0
02
0
* @tc.number SUB_DF_FILEIO_FDATASYNC_SYNC_0
20
0
* @tc.name fileIO_test_fdatasync_sync_002
* @tc.name fileIO_test_fdatasync_sync_002
* @tc.desc Test fdatasyncSync() interfaces. Missing parameter.
* @tc.desc Test fdatasyncSync() interfaces. Missing parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fdatasync_sync_002
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_fdatasync_sync_002
'
,
0
,
async
function
()
{
...
@@ -107,8 +106,8 @@ export default function fileIOFdatasync() {
...
@@ -107,8 +106,8 @@ export default function fileIOFdatasync() {
console
.
log
(
'
fileIO_test_fdatasync_async_000 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_fdatasync_async_000 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
file
io
.
closeSync
(
file
.
fd
);
file
IO
.
closeSync
(
file
);
file
io
.
unlinkSync
(
fpath
);
file
IO
.
unlinkSync
(
fpath
);
done
();
done
();
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -118,13 +117,13 @@ export default function fileIOFdatasync() {
...
@@ -118,13 +117,13 @@ export default function fileIOFdatasync() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0
01
0
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0
10
0
* @tc.name fileIO_test_fdatasync_async_001
* @tc.name fileIO_test_fdatasync_async_001
* @tc.desc Test fdatasync() interfaces. Promise.then().catch().
* @tc.desc Test fdatasync() interfaces. Promise.then().catch().
* Open the file in read-write mode, and synchronize the file content data.
* Open the file in read-write mode, and synchronize the file content data.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fdatasync_async_001
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_fdatasync_async_001
'
,
0
,
async
function
(
done
)
{
...
@@ -133,9 +132,9 @@ export default function fileIOFdatasync() {
...
@@ -133,9 +132,9 @@ export default function fileIOFdatasync() {
try
{
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
file
io
.
fdatasync
(
file
.
fd
).
then
(()
=>
{
file
IO
.
fdatasync
(
file
.
fd
).
then
(()
=>
{
file
io
.
closeSync
(
file
.
fd
);
file
IO
.
closeSync
(
file
);
file
io
.
unlinkSync
(
fpath
);
file
IO
.
unlinkSync
(
fpath
);
done
();
done
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
fileIO_test_fdatasync_async_001 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_fdatasync_async_001 error package:
'
+
JSON
.
stringify
(
err
));
...
@@ -148,13 +147,13 @@ export default function fileIOFdatasync() {
...
@@ -148,13 +147,13 @@ export default function fileIOFdatasync() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0
02
0
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0
20
0
* @tc.name fileIO_test_fdatasync_async_002
* @tc.name fileIO_test_fdatasync_async_002
* @tc.desc Test fdatasync() interfaces. await Promise.
* @tc.desc Test fdatasync() interfaces. await Promise.
* Open the file in read-write mode, and synchronize the file content data.
* Open the file in read-write mode, and synchronize the file content data.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fdatasync_async_002
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_fdatasync_async_002
'
,
0
,
async
function
(
done
)
{
...
@@ -163,9 +162,9 @@ export default function fileIOFdatasync() {
...
@@ -163,9 +162,9 @@ export default function fileIOFdatasync() {
try
{
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
await
file
io
.
fdatasync
(
file
.
fd
);
await
file
IO
.
fdatasync
(
file
.
fd
);
file
io
.
closeSync
(
file
.
fd
);
file
IO
.
closeSync
(
file
);
file
io
.
unlinkSync
(
fpath
);
file
IO
.
unlinkSync
(
fpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_fdatasync_async_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_fdatasync_async_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -174,13 +173,13 @@ export default function fileIOFdatasync() {
...
@@ -174,13 +173,13 @@ export default function fileIOFdatasync() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0
03
0
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0
30
0
* @tc.name fileIO_test_fdatasync_async_003
* @tc.name fileIO_test_fdatasync_async_003
* @tc.desc Test fdatasync() interfaces. await Promise.
* @tc.desc Test fdatasync() interfaces. await Promise.
* Invalid fd parameter.
* Invalid fd parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fdatasync_async_003
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_fdatasync_async_003
'
,
0
,
async
function
(
done
)
{
...
@@ -196,13 +195,13 @@ export default function fileIOFdatasync() {
...
@@ -196,13 +195,13 @@ export default function fileIOFdatasync() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0
04
0
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0
40
0
* @tc.name fileIO_test_fdatasync_async_004
* @tc.name fileIO_test_fdatasync_async_004
* @tc.desc Test fdatasync() interfaces. Callback.
* @tc.desc Test fdatasync() interfaces. Callback.
* Invalid fd parameter.
* Invalid fd parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fdatasync_async_004
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_fdatasync_async_004
'
,
0
,
async
function
(
done
)
{
...
@@ -210,7 +209,7 @@ export default function fileIOFdatasync() {
...
@@ -210,7 +209,7 @@ export default function fileIOFdatasync() {
try
{
try
{
fileIO
.
fdatasync
(
-
1
,
(
err
)
=>
{
fileIO
.
fdatasync
(
-
1
,
(
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_fdatasync_async_004 error
package: {
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
console
.
log
(
'
fileIO_test_fdatasync_async_004 error
: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
expect
(
err
.
code
==
13900008
&&
err
.
message
==
'
Bad file descriptor
'
).
assertTrue
();
expect
(
err
.
code
==
13900008
&&
err
.
message
==
'
Bad file descriptor
'
).
assertTrue
();
done
();
done
();
}
}
...
@@ -222,13 +221,13 @@ export default function fileIOFdatasync() {
...
@@ -222,13 +221,13 @@ export default function fileIOFdatasync() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0
05
0
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0
50
0
* @tc.name fileIO_test_fdatasync_async_005
* @tc.name fileIO_test_fdatasync_async_005
* @tc.desc Test fdatasync() interfaces. Promise.then().catch()
* @tc.desc Test fdatasync() interfaces. Promise.then().catch()
* Invalid fd parameter.
* Invalid fd parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fdatasync_async_005
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_fdatasync_async_005
'
,
0
,
async
function
(
done
)
{
...
@@ -237,7 +236,7 @@ export default function fileIOFdatasync() {
...
@@ -237,7 +236,7 @@ export default function fileIOFdatasync() {
fileIO
.
fdatasync
(
-
1
).
then
(()
=>
{
fileIO
.
fdatasync
(
-
1
).
then
(()
=>
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
fileIO_test_fdatasync_async_005 error
package: {
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
console
.
log
(
'
fileIO_test_fdatasync_async_005 error
: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
expect
(
err
.
code
==
13900008
&&
err
.
message
==
'
Bad file descriptor
'
).
assertTrue
();
expect
(
err
.
code
==
13900008
&&
err
.
message
==
'
Bad file descriptor
'
).
assertTrue
();
done
();
done
();
});
});
...
@@ -248,13 +247,13 @@ export default function fileIOFdatasync() {
...
@@ -248,13 +247,13 @@ export default function fileIOFdatasync() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0
06
0
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0
60
0
* @tc.name fileIO_test_fdatasync_async_006
* @tc.name fileIO_test_fdatasync_async_006
* @tc.desc Test fdatasync() interfaces. Promise.
* @tc.desc Test fdatasync() interfaces. Promise.
* Missing parameter.
* Missing parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fdatasync_async_006
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_fdatasync_async_006
'
,
0
,
async
function
(
done
)
{
...
@@ -270,19 +269,19 @@ export default function fileIOFdatasync() {
...
@@ -270,19 +269,19 @@ export default function fileIOFdatasync() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0
07
0
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0
70
0
* @tc.name fileIO_test_fdatasync_async_007
* @tc.name fileIO_test_fdatasync_async_007
* @tc.desc Test fdatasync() interfaces. Callback.
* @tc.desc Test fdatasync() interfaces. Callback.
* Missing parameter.
* Missing parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fdatasync_async_007
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_fdatasync_async_007
'
,
0
,
async
function
(
done
)
{
try
{
try
{
fileIO
.
fdatasync
(()
=>
{
fileIO
.
fdatasync
((
err
)
=>
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
...
...
storage/storagefileiov9jstest/src/main/js/test/members/fdopenStream.test.js
浏览文件 @
0edfcc10
...
@@ -35,15 +35,15 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -35,15 +35,15 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
let
fp
=
fileIO
.
fdopenStreamSync
(
file
.
fd
,
'
r
'
);
let
fp
r
=
fileIO
.
fdopenStreamSync
(
file
.
fd
,
'
r
'
);
try
{
try
{
expect
(
fp
!==
null
).
assertTrue
();
expect
(
fp
r
!==
null
).
assertTrue
();
expect
(
fp
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
fp
.
writeSync
(
FILE_CONTENT
);
fp
r
.
writeSync
(
FILE_CONTENT
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
fp
.
closeSync
();
fp
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_fdopenstream_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
...
@@ -88,11 +88,11 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -88,11 +88,11 @@ describe('fileIO_fs_FdOpenStream', async function () {
try
{
try
{
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
let
fp
=
fileIO
.
fdopenStreamSync
(
file
.
fd
,
'
r+
'
);
let
fp
r
=
fileIO
.
fdopenStreamSync
(
file
.
fd
,
'
r+
'
);
expect
(
fp
!==
null
).
assertTrue
();
expect
(
fp
r
!==
null
).
assertTrue
();
expect
(
fp
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
r
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
fp
.
closeSync
();
fp
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_fdopenstream_sync_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_fdopenstream_sync_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -224,9 +224,9 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -224,9 +224,9 @@ describe('fileIO_fs_FdOpenStream', async function () {
fpw
.
closeSync
();
fpw
.
closeSync
();
let
file2
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_ONLY
);
let
file2
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_ONLY
);
let
s
r
=
fileIO
.
fdopenStreamSync
(
file2
.
fd
,
'
r
'
);
let
fp
r
=
fileIO
.
fdopenStreamSync
(
file2
.
fd
,
'
r
'
);
expect
(
s
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
s
r
.
closeSync
();
fp
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_fdopenstream_sync_007 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_fdopenstream_sync_007 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -280,15 +280,15 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -280,15 +280,15 @@ describe('fileIO_fs_FdOpenStream', async function () {
try
{
try
{
let
file1
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file1
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
expect
(
isIntNum
(
file1
.
fd
)).
assertTrue
();
expect
(
isIntNum
(
file1
.
fd
)).
assertTrue
();
let
fp
w
=
fileIO
.
fdopenStreamSync
(
file1
.
fd
,
'
a
'
);
let
fp
a
=
fileIO
.
fdopenStreamSync
(
file1
.
fd
,
'
a
'
);
expect
(
fp
w
!==
null
).
assertTrue
();
expect
(
fp
a
!==
null
).
assertTrue
();
expect
(
fp
w
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
fp
w
.
closeSync
();
fp
a
.
closeSync
();
let
file2
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file2
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
s
r
=
fileIO
.
fdopenStreamSync
(
file2
.
fd
,
'
r
'
);
let
fp
r
=
fileIO
.
fdopenStreamSync
(
file2
.
fd
,
'
r
'
);
expect
(
s
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
expect
(
fp
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
s
r
.
closeSync
();
fp
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_fdopenstream_sync_009 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_fdopenstream_sync_009 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -311,15 +311,15 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -311,15 +311,15 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
let
s
a
=
fileIO
.
fdopenStreamSync
(
file
.
fd
,
'
a
'
);
let
fp
a
=
fileIO
.
fdopenStreamSync
(
file
.
fd
,
'
a
'
);
try
{
try
{
expect
(
s
a
!==
null
).
assertTrue
();
expect
(
fp
a
!==
null
).
assertTrue
();
expect
(
s
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
s
a
.
readSync
(
new
ArrayBuffer
(
4096
));
fp
a
.
readSync
(
new
ArrayBuffer
(
4096
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
s
a
.
closeSync
();
fp
a
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_sync_010 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_fdopenstream_sync_010 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
...
@@ -343,11 +343,11 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -343,11 +343,11 @@ describe('fileIO_fs_FdOpenStream', async function () {
try
{
try
{
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
let
s
a
=
fileIO
.
fdopenStreamSync
(
file
.
fd
,
'
a+
'
);
let
fp
a
=
fileIO
.
fdopenStreamSync
(
file
.
fd
,
'
a+
'
);
expect
(
s
a
!==
null
).
assertTrue
();
expect
(
fp
a
!==
null
).
assertTrue
();
expect
(
s
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
a
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
expect
(
fp
a
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
s
a
.
closeSync
();
fp
a
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_fdopenstream_sync_011 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_fdopenstream_sync_011 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -369,16 +369,16 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -369,16 +369,16 @@ describe('fileIO_fs_FdOpenStream', async function () {
let
fpath
=
await
nextFileName
(
'
fileIO_test_fdopenstream_async_000
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_fdopenstream_async_000
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
fp
=
await
fileIO
.
fdopenStream
(
file
.
fd
,
'
r
'
);
let
fp
r
=
await
fileIO
.
fdopenStream
(
file
.
fd
,
'
r
'
);
try
{
try
{
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
expect
(
fp
!==
null
).
assertTrue
();
expect
(
fp
r
!==
null
).
assertTrue
();
expect
(
fp
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
fp
.
writeSync
(
FILE_CONTENT
);
fp
r
.
writeSync
(
FILE_CONTENT
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
fp
.
closeSync
();
fp
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_async_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_fdopenstream_async_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
...
@@ -403,16 +403,16 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -403,16 +403,16 @@ describe('fileIO_fs_FdOpenStream', async function () {
try
{
try
{
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
fileIO
.
fdopenStream
(
file
.
fd
,
'
r
'
,
(
err
,
fp
)
=>
{
fileIO
.
fdopenStream
(
file
.
fd
,
'
r
'
,
(
err
,
fp
r
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_fdopenstream_async_001 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_fdopenstream_async_001 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
expect
(
fp
!==
null
).
assertTrue
();
expect
(
fp
r
!==
null
).
assertTrue
();
expect
(
fp
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
fp
.
write
(
FILE_CONTENT
,
(
err
)
=>
{
fp
r
.
write
(
FILE_CONTENT
,
(
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
fp
.
closeSync
();
fp
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
console
.
log
(
'
fileIO_test_fdopenstream_async_001 error: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
'
fileIO_test_fdopenstream_async_001 error: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
...
@@ -492,11 +492,11 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -492,11 +492,11 @@ describe('fileIO_fs_FdOpenStream', async function () {
try
{
try
{
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
let
fp
=
await
fileIO
.
fdopenStream
(
file
.
fd
,
'
r+
'
);
let
fp
r
=
await
fileIO
.
fdopenStream
(
file
.
fd
,
'
r+
'
);
expect
(
fp
!==
null
).
assertTrue
();
expect
(
fp
r
!==
null
).
assertTrue
();
expect
(
fp
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
r
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
fp
.
closeSync
();
fp
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -522,15 +522,15 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -522,15 +522,15 @@ describe('fileIO_fs_FdOpenStream', async function () {
try
{
try
{
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
fileIO
.
fdopenStream
(
file
.
fd
,
'
r+
'
,
(
err
,
fp
)
=>
{
fileIO
.
fdopenStream
(
file
.
fd
,
'
r+
'
,
(
err
,
fp
r
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_fdopenstream_async_005 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_fdopenstream_async_005 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
expect
(
fp
!==
null
).
assertTrue
();
expect
(
fp
r
!==
null
).
assertTrue
();
expect
(
fp
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
r
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
fp
.
closeSync
();
fp
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
});
});
...
@@ -689,9 +689,9 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -689,9 +689,9 @@ describe('fileIO_fs_FdOpenStream', async function () {
fpw
.
closeSync
();
fpw
.
closeSync
();
let
file2
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file2
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
s
r
=
await
fileIO
.
fdopenStream
(
file2
.
fd
,
'
r
'
);
let
fp
r
=
await
fileIO
.
fdopenStream
(
file2
.
fd
,
'
r
'
);
expect
(
s
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
s
r
.
closeSync
();
fp
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -781,15 +781,15 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -781,15 +781,15 @@ describe('fileIO_fs_FdOpenStream', async function () {
try
{
try
{
let
file1
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file1
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
fp
w
=
await
fileIO
.
fdopenStream
(
file1
.
fd
,
'
a
'
);
let
fp
a
=
await
fileIO
.
fdopenStream
(
file1
.
fd
,
'
a
'
);
expect
(
fp
w
!==
null
).
assertTrue
();
expect
(
fp
a
!==
null
).
assertTrue
();
expect
(
fp
w
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
fp
w
.
closeSync
();
fp
a
.
closeSync
();
let
file2
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file2
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
s
r
=
await
fileIO
.
fdopenStream
(
file2
.
fd
,
'
r
'
);
let
fp
r
=
await
fileIO
.
fdopenStream
(
file2
.
fd
,
'
r
'
);
expect
(
s
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
expect
(
fp
r
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
s
r
.
closeSync
();
fp
r
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -813,15 +813,15 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -813,15 +813,15 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
let
s
a
=
await
fileIO
.
fdopenStream
(
file
.
fd
,
'
a
'
);
let
fp
a
=
await
fileIO
.
fdopenStream
(
file
.
fd
,
'
a
'
);
try
{
try
{
expect
(
s
a
!==
null
).
assertTrue
();
expect
(
fp
a
!==
null
).
assertTrue
();
expect
(
s
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
s
a
.
readSync
(
new
ArrayBuffer
(
4096
));
fp
a
.
readSync
(
new
ArrayBuffer
(
4096
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
}
catch
(
e
)
{
s
a
.
closeSync
();
fp
a
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_async_014 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_fdopenstream_async_014 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
...
@@ -846,16 +846,16 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -846,16 +846,16 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
try
{
try
{
fileIO
.
fdopenStream
(
file
.
fd
,
'
a
'
,
(
err
,
s
a
)
=>
{
fileIO
.
fdopenStream
(
file
.
fd
,
'
a
'
,
(
err
,
fp
a
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_fdopenstream_async_015 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_fdopenstream_async_015 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
expect
(
s
a
!==
null
).
assertTrue
();
expect
(
fp
a
!==
null
).
assertTrue
();
expect
(
s
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
s
a
.
read
(
new
ArrayBuffer
(
4096
),
(
err
)
=>
{
fp
a
.
read
(
new
ArrayBuffer
(
4096
),
(
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
s
a
.
closeSync
();
fp
a
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
console
.
log
(
'
fileIO_test_fdopenstream_async_015 error: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
'
fileIO_test_fdopenstream_async_015 error: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
...
@@ -890,11 +890,11 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -890,11 +890,11 @@ describe('fileIO_fs_FdOpenStream', async function () {
try
{
try
{
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
let
s
a
=
await
fileIO
.
fdopenStream
(
file
.
fd
,
'
a+
'
);
let
fp
a
=
await
fileIO
.
fdopenStream
(
file
.
fd
,
'
a+
'
);
expect
(
s
a
!==
null
).
assertTrue
();
expect
(
fp
a
!==
null
).
assertTrue
();
expect
(
s
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
a
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
expect
(
fp
a
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
s
a
.
closeSync
();
fp
a
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -920,15 +920,15 @@ describe('fileIO_fs_FdOpenStream', async function () {
...
@@ -920,15 +920,15 @@ describe('fileIO_fs_FdOpenStream', async function () {
try
{
try
{
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
fileIO
.
fdopenStream
(
file
.
fd
,
'
a+
'
,
(
err
,
s
a
)
=>
{
fileIO
.
fdopenStream
(
file
.
fd
,
'
a+
'
,
(
err
,
fp
a
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_fdopenstream_async_017 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_fdopenstream_async_017 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
expect
(
s
a
!==
null
).
assertTrue
();
expect
(
fp
a
!==
null
).
assertTrue
();
expect
(
s
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fp
a
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
s
a
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
expect
(
fp
a
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
s
a
.
closeSync
();
fp
a
.
closeSync
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
done
();
done
();
});
});
...
...
storage/storagefileiov9jstest/src/main/js/test/members/fileLock.test.js
浏览文件 @
0edfcc10
此差异已折叠。
点击以展开。
storage/storagefileiov9jstest/src/main/js/test/members/fsync.test.js
浏览文件 @
0edfcc10
...
@@ -14,8 +14,7 @@
...
@@ -14,8 +14,7 @@
*/
*/
import
{
import
{
fileio
,
fileIO
,
FILE_CONTENT
,
prepareFile
,
nextFileName
,
fileIO
,
FILE_CONTENT
,
prepareFile
,
nextFileName
,
describe
,
it
,
expect
,
describe
,
it
,
expect
,
}
from
'
../Common
'
;
}
from
'
../Common
'
;
export
default
function
fileIOFsync
()
{
export
default
function
fileIOFsync
()
{
...
@@ -38,8 +37,8 @@ describe('fileIO_fs_fsync', function () {
...
@@ -38,8 +37,8 @@ describe('fileIO_fs_fsync', function () {
try
{
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
fileIO
.
fsyncSync
(
file
.
fd
);
fileIO
.
fsyncSync
(
file
.
fd
);
file
io
.
closeSync
(
file
.
fd
);
file
IO
.
closeSync
(
file
);
file
io
.
unlinkSync
(
fpath
);
file
IO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_fsync_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_fsync_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
...
@@ -47,12 +46,12 @@ describe('fileIO_fs_fsync', function () {
...
@@ -47,12 +46,12 @@ describe('fileIO_fs_fsync', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FSYNC_SYNC_0
01
0
* @tc.number SUB_DF_FILEIO_FSYNC_SYNC_0
10
0
* @tc.name fileIO_test_fsync_sync_001
* @tc.name fileIO_test_fsync_sync_001
* @tc.desc Test fsyncSync() interface. Invalid fd parameter.
* @tc.desc Test fsyncSync() interface. Invalid fd parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fsync_sync_001
'
,
0
,
function
()
{
it
(
'
fileIO_test_fsync_sync_001
'
,
0
,
function
()
{
...
@@ -67,12 +66,12 @@ describe('fileIO_fs_fsync', function () {
...
@@ -67,12 +66,12 @@ describe('fileIO_fs_fsync', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FSYNC_SYNC_0
02
0
* @tc.number SUB_DF_FILEIO_FSYNC_SYNC_0
20
0
* @tc.name fileIO_test_fsync_sync_002
* @tc.name fileIO_test_fsync_sync_002
* @tc.desc Test fsyncSync() interface. Missing parameter.
* @tc.desc Test fsyncSync() interface. Missing parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fsync_sync_002
'
,
0
,
function
()
{
it
(
'
fileIO_test_fsync_sync_002
'
,
0
,
function
()
{
...
@@ -103,8 +102,8 @@ describe('fileIO_fs_fsync', function () {
...
@@ -103,8 +102,8 @@ describe('fileIO_fs_fsync', function () {
try
{
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
await
fileIO
.
fsync
(
file
.
fd
);
await
fileIO
.
fsync
(
file
.
fd
);
file
io
.
closeSync
(
file
.
fd
);
file
IO
.
closeSync
(
file
);
file
io
.
unlinkSync
(
fpath
);
file
IO
.
unlinkSync
(
fpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_fsync_async_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_fsync_async_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -113,13 +112,13 @@ describe('fileIO_fs_fsync', function () {
...
@@ -113,13 +112,13 @@ describe('fileIO_fs_fsync', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_0
01
0
* @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_0
10
0
* @tc.name fileIO_test_fsync_async_001
* @tc.name fileIO_test_fsync_async_001
* @tc.desc Test fsync() interface. Promise.then().catch()
* @tc.desc Test fsync() interface. Promise.then().catch()
* Open the file in read-write mode, and synchronize the file content data.
* Open the file in read-write mode, and synchronize the file content data.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fsync_async_001
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_fsync_async_001
'
,
0
,
async
function
(
done
)
{
...
@@ -129,8 +128,8 @@ describe('fileIO_fs_fsync', function () {
...
@@ -129,8 +128,8 @@ describe('fileIO_fs_fsync', function () {
try
{
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
fileIO
.
fsync
(
file
.
fd
).
then
(()
=>
{
fileIO
.
fsync
(
file
.
fd
).
then
(()
=>
{
file
io
.
closeSync
(
file
.
fd
);
file
IO
.
closeSync
(
file
);
file
io
.
unlinkSync
(
fpath
);
file
IO
.
unlinkSync
(
fpath
);
done
();
done
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
fileIO_test_fsync_async_001 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_fsync_async_001 error package:
'
+
JSON
.
stringify
(
err
));
...
@@ -143,13 +142,13 @@ describe('fileIO_fs_fsync', function () {
...
@@ -143,13 +142,13 @@ describe('fileIO_fs_fsync', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_0
02
* @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_0
200
* @tc.name fileIO_test_fsync_async_002
* @tc.name fileIO_test_fsync_async_002
* @tc.desc Test fsync() interface. Callback.
* @tc.desc Test fsync() interface. Callback.
* Open the file in read-write mode, and synchronize the file content data.
* Open the file in read-write mode, and synchronize the file content data.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fsync_async_002
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_fsync_async_002
'
,
0
,
async
function
(
done
)
{
...
@@ -163,8 +162,8 @@ describe('fileIO_fs_fsync', function () {
...
@@ -163,8 +162,8 @@ describe('fileIO_fs_fsync', function () {
console
.
log
(
'
fileIO_test_fsync_async_002 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_fsync_async_002 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
file
io
.
closeSync
(
file
.
fd
);
file
IO
.
closeSync
(
file
);
file
io
.
unlinkSync
(
fpath
);
file
IO
.
unlinkSync
(
fpath
);
});
});
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -174,13 +173,13 @@ describe('fileIO_fs_fsync', function () {
...
@@ -174,13 +173,13 @@ describe('fileIO_fs_fsync', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_0
03
* @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_0
300
* @tc.name fileIO_test_fsync_async_003
* @tc.name fileIO_test_fsync_async_003
* @tc.desc Test fsync() interface. await Promise.
* @tc.desc Test fsync() interface. await Promise.
* Invalid fd parameter.
* Invalid fd parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fsync_async_003
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_fsync_async_003
'
,
0
,
async
function
(
done
)
{
...
@@ -196,13 +195,13 @@ describe('fileIO_fs_fsync', function () {
...
@@ -196,13 +195,13 @@ describe('fileIO_fs_fsync', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_0
04
* @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_0
400
* @tc.name fileIO_test_fsync_async_004
* @tc.name fileIO_test_fsync_async_004
* @tc.desc Test fsync() interface. Callback.
* @tc.desc Test fsync() interface. Callback.
* Invalid fd parameter.
* Invalid fd parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fsync_async_004
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_fsync_async_004
'
,
0
,
async
function
(
done
)
{
...
@@ -210,7 +209,7 @@ describe('fileIO_fs_fsync', function () {
...
@@ -210,7 +209,7 @@ describe('fileIO_fs_fsync', function () {
try
{
try
{
fileIO
.
fsync
(
-
1
,
(
err
)
=>
{
fileIO
.
fsync
(
-
1
,
(
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_fsync_async_004 error
package: {
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
console
.
log
(
'
fileIO_test_fsync_async_004 error
: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
expect
(
err
.
code
==
13900008
&&
err
.
message
==
'
Bad file descriptor
'
).
assertTrue
();
expect
(
err
.
code
==
13900008
&&
err
.
message
==
'
Bad file descriptor
'
).
assertTrue
();
done
();
done
();
}
}
...
@@ -222,13 +221,13 @@ describe('fileIO_fs_fsync', function () {
...
@@ -222,13 +221,13 @@ describe('fileIO_fs_fsync', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_0
05
* @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_0
500
* @tc.name fileIO_test_fsync_async_005
* @tc.name fileIO_test_fsync_async_005
* @tc.desc Test fsync() interface. Promise.then().catch()
* @tc.desc Test fsync() interface. Promise.then().catch()
* Missing parameter.
* Missing parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fsync_async_005
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_fsync_async_005
'
,
0
,
async
function
(
done
)
{
...
@@ -237,7 +236,7 @@ describe('fileIO_fs_fsync', function () {
...
@@ -237,7 +236,7 @@ describe('fileIO_fs_fsync', function () {
fileIO
.
fsync
(
-
1
).
then
(()
=>
{
fileIO
.
fsync
(
-
1
).
then
(()
=>
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
fileIO_test_fsync_async_005 error
package: {
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
console
.
log
(
'
fileIO_test_fsync_async_005 error
: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
expect
(
err
.
code
==
13900008
&&
err
.
message
==
'
Bad file descriptor
'
).
assertTrue
();
expect
(
err
.
code
==
13900008
&&
err
.
message
==
'
Bad file descriptor
'
).
assertTrue
();
done
();
done
();
});
});
...
@@ -248,13 +247,13 @@ describe('fileIO_fs_fsync', function () {
...
@@ -248,13 +247,13 @@ describe('fileIO_fs_fsync', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_0
06
* @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_0
600
* @tc.name fileIO_test_fsync_async_006
* @tc.name fileIO_test_fsync_async_006
* @tc.desc Test fsync() interface. await Promise.
* @tc.desc Test fsync() interface. await Promise.
* Missing parameter.
* Missing parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fsync_async_006
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_fsync_async_006
'
,
0
,
async
function
(
done
)
{
...
@@ -270,19 +269,19 @@ describe('fileIO_fs_fsync', function () {
...
@@ -270,19 +269,19 @@ describe('fileIO_fs_fsync', function () {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_0
06
* @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_0
700
* @tc.name fileIO_test_fsync_async_00
6
* @tc.name fileIO_test_fsync_async_00
7
* @tc.desc Test fsync() interface. Callback.
* @tc.desc Test fsync() interface. Callback.
* Missing parameter.
* Missing parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_fsync_async_007
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_fsync_async_007
'
,
0
,
async
function
(
done
)
{
try
{
try
{
fileIO
.
fsync
(()
=>
{
fileIO
.
fsync
((
err
)
=>
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
...
...
storage/storagefileiov9jstest/src/main/js/test/members/listFile.test.js
浏览文件 @
0edfcc10
...
@@ -57,7 +57,7 @@ export default function fileIOListfile() {
...
@@ -57,7 +57,7 @@ export default function fileIOListfile() {
* Do not have prop filter.Filter files by quantity only.
* Do not have prop filter.Filter files by quantity only.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_sync_001
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_sync_001
'
,
0
,
async
function
()
{
...
@@ -90,7 +90,7 @@ export default function fileIOListfile() {
...
@@ -90,7 +90,7 @@ export default function fileIOListfile() {
* Do not have prop listNum.
* Do not have prop listNum.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_sync_002
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_sync_002
'
,
0
,
async
function
()
{
...
@@ -129,7 +129,7 @@ export default function fileIOListfile() {
...
@@ -129,7 +129,7 @@ export default function fileIOListfile() {
* Do not have prop suffix. Not filter files by suffix.
* Do not have prop suffix. Not filter files by suffix.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_sync_003
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_sync_003
'
,
0
,
async
function
()
{
...
@@ -168,7 +168,7 @@ export default function fileIOListfile() {
...
@@ -168,7 +168,7 @@ export default function fileIOListfile() {
* Scanfile.Retain six files in the three-level directory.
* Scanfile.Retain six files in the three-level directory.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_sync_004
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_sync_004
'
,
0
,
async
function
()
{
...
@@ -226,7 +226,7 @@ export default function fileIOListfile() {
...
@@ -226,7 +226,7 @@ export default function fileIOListfile() {
* Filter out files whose suffix is not '. txt' and does not meet other conditions.Two files are retained.
* Filter out files whose suffix is not '. txt' and does not meet other conditions.Two files are retained.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_sync_005
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_sync_005
'
,
0
,
async
function
()
{
...
@@ -268,7 +268,7 @@ export default function fileIOListfile() {
...
@@ -268,7 +268,7 @@ export default function fileIOListfile() {
* Invalid file suffix name format.
* Invalid file suffix name format.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_sync_006
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_sync_006
'
,
0
,
async
function
()
{
...
@@ -308,7 +308,7 @@ export default function fileIOListfile() {
...
@@ -308,7 +308,7 @@ export default function fileIOListfile() {
* Filter out all files because the size of all files less than 12.
* Filter out all files because the size of all files less than 12.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_sync_007
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_sync_007
'
,
0
,
async
function
()
{
...
@@ -348,7 +348,7 @@ export default function fileIOListfile() {
...
@@ -348,7 +348,7 @@ export default function fileIOListfile() {
* listNum is 0.Traverse all files.
* listNum is 0.Traverse all files.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_sync_008
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_sync_008
'
,
0
,
async
function
()
{
...
@@ -390,7 +390,7 @@ export default function fileIOListfile() {
...
@@ -390,7 +390,7 @@ export default function fileIOListfile() {
* Missing all arguments.
* Missing all arguments.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_sync_009
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_sync_009
'
,
0
,
async
function
()
{
...
@@ -411,7 +411,7 @@ export default function fileIOListfile() {
...
@@ -411,7 +411,7 @@ export default function fileIOListfile() {
* Invalid option args.
* Invalid option args.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_sync_010
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_sync_010
'
,
0
,
async
function
()
{
...
@@ -463,7 +463,7 @@ export default function fileIOListfile() {
...
@@ -463,7 +463,7 @@ export default function fileIOListfile() {
fileIO
.
rmdirSync
(
dpath
);
fileIO
.
rmdirSync
(
dpath
);
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
info
(
'
fileIO_test_listfile_async_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_listfile_async_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
});
});
...
@@ -475,7 +475,7 @@ export default function fileIOListfile() {
...
@@ -475,7 +475,7 @@ export default function fileIOListfile() {
* Only path, do not filter file.
* Only path, do not filter file.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_001
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_listfile_async_001
'
,
0
,
async
function
(
done
)
{
...
@@ -494,7 +494,7 @@ export default function fileIOListfile() {
...
@@ -494,7 +494,7 @@ export default function fileIOListfile() {
fileIO
.
rmdirSync
(
dpath
);
fileIO
.
rmdirSync
(
dpath
);
done
();
done
();
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
fileIO_test_listfile_async_001 has failed for
'
+
err
.
message
+
'
, code:
'
+
err
.
code
);
console
.
log
(
'
fileIO_test_listfile_async_001 has failed for
'
+
err
.
message
+
'
, code:
'
+
err
.
code
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
});
});
...
@@ -506,7 +506,7 @@ export default function fileIOListfile() {
...
@@ -506,7 +506,7 @@ export default function fileIOListfile() {
* Do not have prop filter.Filter files by quantity only.
* Do not have prop filter.Filter files by quantity only.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_002
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_async_002
'
,
0
,
async
function
()
{
...
@@ -544,7 +544,7 @@ export default function fileIOListfile() {
...
@@ -544,7 +544,7 @@ export default function fileIOListfile() {
* Do not have prop filter.Filter files by quantity only.
* Do not have prop filter.Filter files by quantity only.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_003
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_listfile_async_003
'
,
0
,
async
function
(
done
)
{
...
@@ -578,7 +578,7 @@ export default function fileIOListfile() {
...
@@ -578,7 +578,7 @@ export default function fileIOListfile() {
* Do not have prop listNum.
* Do not have prop listNum.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_004
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_async_004
'
,
0
,
async
function
()
{
...
@@ -610,7 +610,7 @@ export default function fileIOListfile() {
...
@@ -610,7 +610,7 @@ export default function fileIOListfile() {
fileIO
.
rmdirSync
(
dpath
);
fileIO
.
rmdirSync
(
dpath
);
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
info
(
'
fileIO_test_listfile_async_004 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_listfile_async_004 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
});
});
...
@@ -622,7 +622,7 @@ export default function fileIOListfile() {
...
@@ -622,7 +622,7 @@ export default function fileIOListfile() {
* Do not have prop listNum.
* Do not have prop listNum.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_005
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_listfile_async_005
'
,
0
,
async
function
(
done
)
{
...
@@ -650,7 +650,7 @@ export default function fileIOListfile() {
...
@@ -650,7 +650,7 @@ export default function fileIOListfile() {
fileIO
.
rmdirSync
(
dpath
);
fileIO
.
rmdirSync
(
dpath
);
done
();
done
();
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
fileIO_test_listfile_async_005 has failed for
'
+
err
.
message
+
'
, code:
'
+
err
.
code
);
console
.
log
(
'
fileIO_test_listfile_async_005 has failed for
'
+
err
.
message
+
'
, code:
'
+
err
.
code
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
});
});
...
@@ -662,7 +662,7 @@ export default function fileIOListfile() {
...
@@ -662,7 +662,7 @@ export default function fileIOListfile() {
* Do not have prop suffix. Not filter files by suffix.
* Do not have prop suffix. Not filter files by suffix.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_006
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_async_006
'
,
0
,
async
function
()
{
...
@@ -706,7 +706,7 @@ export default function fileIOListfile() {
...
@@ -706,7 +706,7 @@ export default function fileIOListfile() {
* Do not have prop suffix. Not filter files by suffix.
* Do not have prop suffix. Not filter files by suffix.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_007
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_listfile_async_007
'
,
0
,
async
function
(
done
)
{
...
@@ -746,7 +746,7 @@ export default function fileIOListfile() {
...
@@ -746,7 +746,7 @@ export default function fileIOListfile() {
* Scanfile.Retain six files in the three-level directory.
* Scanfile.Retain six files in the three-level directory.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_008
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_async_008
'
,
0
,
async
function
()
{
...
@@ -809,7 +809,7 @@ export default function fileIOListfile() {
...
@@ -809,7 +809,7 @@ export default function fileIOListfile() {
* Scanfile.Retain six files in the three-level directory.
* Scanfile.Retain six files in the three-level directory.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_009
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_listfile_async_009
'
,
0
,
async
function
(
done
)
{
...
@@ -868,7 +868,7 @@ export default function fileIOListfile() {
...
@@ -868,7 +868,7 @@ export default function fileIOListfile() {
* Filter out files whose suffix is not '. txt' and does not meet other conditions.Two files are retained.
* Filter out files whose suffix is not '. txt' and does not meet other conditions.Two files are retained.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_010
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_async_010
'
,
0
,
async
function
()
{
...
@@ -915,7 +915,7 @@ export default function fileIOListfile() {
...
@@ -915,7 +915,7 @@ export default function fileIOListfile() {
* Filter out files whose suffix is not '. txt' and does not meet other conditions.Two files are retained.
* Filter out files whose suffix is not '. txt' and does not meet other conditions.Two files are retained.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_011
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_listfile_async_011
'
,
0
,
async
function
(
done
)
{
...
@@ -958,7 +958,7 @@ export default function fileIOListfile() {
...
@@ -958,7 +958,7 @@ export default function fileIOListfile() {
* Invalid file suffix name format.
* Invalid file suffix name format.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_012
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_async_012
'
,
0
,
async
function
()
{
...
@@ -1001,7 +1001,7 @@ export default function fileIOListfile() {
...
@@ -1001,7 +1001,7 @@ export default function fileIOListfile() {
* Invalid file suffix name format.
* Invalid file suffix name format.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_013
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_listfile_async_013
'
,
0
,
async
function
(
done
)
{
...
@@ -1044,7 +1044,7 @@ export default function fileIOListfile() {
...
@@ -1044,7 +1044,7 @@ export default function fileIOListfile() {
* Filter out all files because the size of all files less than 12.
* Filter out all files because the size of all files less than 12.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_014
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_async_014
'
,
0
,
async
function
()
{
...
@@ -1089,7 +1089,7 @@ export default function fileIOListfile() {
...
@@ -1089,7 +1089,7 @@ export default function fileIOListfile() {
* Filter out all files because the size of all files less than 12.
* Filter out all files because the size of all files less than 12.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_015
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_listfile_async_015
'
,
0
,
async
function
(
done
)
{
...
@@ -1130,7 +1130,7 @@ export default function fileIOListfile() {
...
@@ -1130,7 +1130,7 @@ export default function fileIOListfile() {
* listNum is 0.Traverse all files.
* listNum is 0.Traverse all files.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_016
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_listfile_async_016
'
,
0
,
async
function
()
{
...
@@ -1177,7 +1177,7 @@ export default function fileIOListfile() {
...
@@ -1177,7 +1177,7 @@ export default function fileIOListfile() {
* listNum is 0.Traverse all files.
* listNum is 0.Traverse all files.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_017
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_listfile_async_017
'
,
0
,
async
function
(
done
)
{
...
@@ -1220,7 +1220,7 @@ export default function fileIOListfile() {
...
@@ -1220,7 +1220,7 @@ export default function fileIOListfile() {
* Missing all arguments.
* Missing all arguments.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_018
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_listfile_async_018
'
,
0
,
async
function
(
done
)
{
...
@@ -1242,7 +1242,7 @@ export default function fileIOListfile() {
...
@@ -1242,7 +1242,7 @@ export default function fileIOListfile() {
* Invalid option args.
* Invalid option args.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_listfile_async_019
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_listfile_async_019
'
,
0
,
async
function
(
done
)
{
...
...
storage/storagefileiov9jstest/src/main/js/test/members/lstat.test.js
浏览文件 @
0edfcc10
此差异已折叠。
点击以展开。
storage/storagefileiov9jstest/src/main/js/test/members/mkdir.test.js
浏览文件 @
0edfcc10
...
@@ -96,7 +96,7 @@ describe('fileIO_fs_mkdir', function () {
...
@@ -96,7 +96,7 @@ describe('fileIO_fs_mkdir', function () {
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_mkdir_sync_003
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_mkdir_sync_003
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_
open_sync_000
'
);
let
fpath
=
await
nextFileName
(
'
fileIO_test_
mkdir_sync_003
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
...
@@ -198,7 +198,7 @@ describe('fileIO_fs_mkdir', function () {
...
@@ -198,7 +198,7 @@ describe('fileIO_fs_mkdir', function () {
try
{
try
{
fileIO
.
mkdir
(
'
/
'
,
(
err
)
=>
{
fileIO
.
mkdir
(
'
/
'
,
(
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_mkdir_async_003 error
package: {
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
console
.
log
(
'
fileIO_test_mkdir_async_003 error
: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
expect
(
err
.
code
==
13900015
&&
err
.
message
==
'
File exists
'
).
assertTrue
();
expect
(
err
.
code
==
13900015
&&
err
.
message
==
'
File exists
'
).
assertTrue
();
done
();
done
();
}
}
...
...
storage/storagefileiov9jstest/src/main/js/test/members/moveFile.test.js
浏览文件 @
0edfcc10
...
@@ -21,7 +21,7 @@ export default function fileIOMoveFile() {
...
@@ -21,7 +21,7 @@ export default function fileIOMoveFile() {
describe
(
'
fileIO_fs_moveFile
'
,
function
()
{
describe
(
'
fileIO_fs_moveFile
'
,
function
()
{
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILESYNC_0000
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
SYNC_0000
* @tc.name fileIO_test_moveFile_sync_000
* @tc.name fileIO_test_moveFile_sync_000
* @tc.desc Test moveFileSync() interface.
* @tc.desc Test moveFileSync() interface.
* Move a single file, shall work properly in normal case.
* Move a single file, shall work properly in normal case.
...
@@ -51,13 +51,13 @@ export default function fileIOMoveFile() {
...
@@ -51,13 +51,13 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILESYNC_0100
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
SYNC_0100
* @tc.name fileIO_test_moveFile_sync_001
* @tc.name fileIO_test_moveFile_sync_001
* @tc.desc Test moveFileSync() interface.
* @tc.desc Test moveFileSync() interface.
* A file with the same name already exists under the destination path.
* A file with the same name already exists under the destination path.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_moveFile_sync_001
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_moveFile_sync_001
'
,
0
,
async
function
()
{
...
@@ -81,13 +81,13 @@ export default function fileIOMoveFile() {
...
@@ -81,13 +81,13 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILESYNC_0200
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
SYNC_0200
* @tc.name fileIO_test_moveFile_sync_002
* @tc.name fileIO_test_moveFile_sync_002
* @tc.desc Test moveFileSync() interface.
* @tc.desc Test moveFileSync() interface.
* The path point to nothing, no such file.
* The path point to nothing, no such file.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_moveFile_sync_002
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_moveFile_sync_002
'
,
0
,
async
function
()
{
...
@@ -109,13 +109,13 @@ export default function fileIOMoveFile() {
...
@@ -109,13 +109,13 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILESYNC_0400
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
SYNC_0400
* @tc.name fileIO_test_moveFile_sync_004
* @tc.name fileIO_test_moveFile_sync_004
* @tc.desc Test moveFileSync() interface.
* @tc.desc Test moveFileSync() interface.
* The path point to a directory, not a file.
* The path point to a directory, not a file.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_moveFile_sync_004
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_moveFile_sync_004
'
,
0
,
async
function
()
{
...
@@ -134,13 +134,13 @@ export default function fileIOMoveFile() {
...
@@ -134,13 +134,13 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILESYNC_0500
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
SYNC_0500
* @tc.name fileIO_test_moveFile_sync_005
* @tc.name fileIO_test_moveFile_sync_005
* @tc.desc Test moveFileSync() interface.
* @tc.desc Test moveFileSync() interface.
* Missing parameter.
* Missing parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_moveFile_sync_005
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_moveFile_sync_005
'
,
0
,
async
function
()
{
...
@@ -158,13 +158,13 @@ export default function fileIOMoveFile() {
...
@@ -158,13 +158,13 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILESYNC_0600
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
SYNC_0600
* @tc.name fileIO_test_moveFile_sync_006
* @tc.name fileIO_test_moveFile_sync_006
* @tc.desc Test moveFileSync() interface.
* @tc.desc Test moveFileSync() interface.
* Entry parameters increase forced movement when mode = 0.
* Entry parameters increase forced movement when mode = 0.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_moveFile_sync_006
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_moveFile_sync_006
'
,
0
,
async
function
()
{
...
@@ -189,7 +189,7 @@ export default function fileIOMoveFile() {
...
@@ -189,7 +189,7 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILEASYNC_0000
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
ASYNC_0000
* @tc.name fileIO_test_moveFile_async_000
* @tc.name fileIO_test_moveFile_async_000
* @tc.desc Test moveFile() interface. Promise.
* @tc.desc Test moveFile() interface. Promise.
* Move a single file, shall work properly in normal case.
* Move a single file, shall work properly in normal case.
...
@@ -220,13 +220,13 @@ export default function fileIOMoveFile() {
...
@@ -220,13 +220,13 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILEASYNC_0100
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
ASYNC_0100
* @tc.name fileIO_test_moveFile_async_001
* @tc.name fileIO_test_moveFile_async_001
* @tc.desc Test moveFile() interface. Callback.
* @tc.desc Test moveFile() interface. Callback.
* Move a single file, shall work properly in normal case.
* Move a single file, shall work properly in normal case.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_moveFile_async_001
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_moveFile_async_001
'
,
0
,
async
function
(
done
)
{
...
@@ -256,13 +256,13 @@ export default function fileIOMoveFile() {
...
@@ -256,13 +256,13 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILEASYNC_0200
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
ASYNC_0200
* @tc.name fileIO_test_moveFile_async_002
* @tc.name fileIO_test_moveFile_async_002
* @tc.desc Test moveFile() interface. Promise.
* @tc.desc Test moveFile() interface. Promise.
* A file with the same name already exists under the destination path.
* A file with the same name already exists under the destination path.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_moveFile_async_002
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_moveFile_async_002
'
,
0
,
async
function
(
done
)
{
...
@@ -287,13 +287,13 @@ export default function fileIOMoveFile() {
...
@@ -287,13 +287,13 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILEASYNC_0300
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
ASYNC_0300
* @tc.name fileIO_test_moveFile_async_003
* @tc.name fileIO_test_moveFile_async_003
* @tc.desc Test moveFile() interface. Callback.
* @tc.desc Test moveFile() interface. Callback.
* A file with the same name already exists under the destination path.
* A file with the same name already exists under the destination path.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_moveFile_async_003
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_moveFile_async_003
'
,
0
,
async
function
(
done
)
{
...
@@ -310,7 +310,7 @@ export default function fileIOMoveFile() {
...
@@ -310,7 +310,7 @@ export default function fileIOMoveFile() {
fileIO
.
moveFile
(
fpath
,
ffpath
,
1
,
(
err
)
=>
{
fileIO
.
moveFile
(
fpath
,
ffpath
,
1
,
(
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
fileIO
.
rmdirSync
(
dpath
);
fileIO
.
rmdirSync
(
dpath
);
console
.
log
(
'
fileIO_test_moveFile_async_003 error
package: {
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
console
.
log
(
'
fileIO_test_moveFile_async_003 error
: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
expect
(
err
.
code
==
13900015
&&
err
.
message
==
'
File exists
'
).
assertTrue
();
expect
(
err
.
code
==
13900015
&&
err
.
message
==
'
File exists
'
).
assertTrue
();
done
();
done
();
}
}
...
@@ -322,13 +322,13 @@ export default function fileIOMoveFile() {
...
@@ -322,13 +322,13 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILEASYNC_0400
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
ASYNC_0400
* @tc.name fileIO_test_moveFile_async_004
* @tc.name fileIO_test_moveFile_async_004
* @tc.desc Test moveFile() interface. Promise.
* @tc.desc Test moveFile() interface. Promise.
* The path point to nothing, no such file.
* The path point to nothing, no such file.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_moveFile_async_004
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_moveFile_async_004
'
,
0
,
async
function
(
done
)
{
...
@@ -351,13 +351,13 @@ export default function fileIOMoveFile() {
...
@@ -351,13 +351,13 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILEASYNC_0500
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
ASYNC_0500
* @tc.name fileIO_test_moveFile_async_005
* @tc.name fileIO_test_moveFile_async_005
* @tc.desc Test moveFile() interface. Callback.
* @tc.desc Test moveFile() interface. Callback.
* The path point to nothing, no such file.
* The path point to nothing, no such file.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_moveFile_async_005
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_moveFile_async_005
'
,
0
,
async
function
(
done
)
{
...
@@ -372,7 +372,7 @@ export default function fileIOMoveFile() {
...
@@ -372,7 +372,7 @@ export default function fileIOMoveFile() {
fileIO
.
moveFile
(
fpath
,
ffpath
,
(
err
)
=>
{
fileIO
.
moveFile
(
fpath
,
ffpath
,
(
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
fileIO
.
rmdirSync
(
dpath
);
fileIO
.
rmdirSync
(
dpath
);
console
.
log
(
'
fileIO_test_moveFile_async_005 error
package: {
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
console
.
log
(
'
fileIO_test_moveFile_async_005 error
: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
expect
(
err
.
code
==
13900002
&&
err
.
message
==
'
No such file or directory
'
).
assertTrue
();
expect
(
err
.
code
==
13900002
&&
err
.
message
==
'
No such file or directory
'
).
assertTrue
();
done
();
done
();
}
}
...
@@ -384,13 +384,13 @@ export default function fileIOMoveFile() {
...
@@ -384,13 +384,13 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILEASYNC_0600
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
ASYNC_0600
* @tc.name fileIO_test_moveFile_async_006
* @tc.name fileIO_test_moveFile_async_006
* @tc.desc Test moveFile() interface. Promise.
* @tc.desc Test moveFile() interface. Promise.
* The path point to a directory, not a file.
* The path point to a directory, not a file.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_moveFile_async_006
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_moveFile_async_006
'
,
0
,
async
function
(
done
)
{
...
@@ -410,13 +410,13 @@ export default function fileIOMoveFile() {
...
@@ -410,13 +410,13 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILEASYNC_0700
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
ASYNC_0700
* @tc.name fileIO_test_moveFile_async_007
* @tc.name fileIO_test_moveFile_async_007
* @tc.desc Test moveFile() interface. Callback.
* @tc.desc Test moveFile() interface. Callback.
* The path point to a directory, not a file.
* The path point to a directory, not a file.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_moveFile_async_007
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_moveFile_async_007
'
,
0
,
async
function
(
done
)
{
...
@@ -440,13 +440,13 @@ export default function fileIOMoveFile() {
...
@@ -440,13 +440,13 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILEASYNC_0800
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
ASYNC_0800
* @tc.name fileIO_test_moveFile_async_008
* @tc.name fileIO_test_moveFile_async_008
* @tc.desc Test moveFile() interface. Promise.
* @tc.desc Test moveFile() interface. Promise.
* Missing parameter.
* Missing parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_moveFile_async_008
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_moveFile_async_008
'
,
0
,
async
function
(
done
)
{
...
@@ -465,13 +465,13 @@ export default function fileIOMoveFile() {
...
@@ -465,13 +465,13 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILEASYNC_0900
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
ASYNC_0900
* @tc.name fileIO_test_moveFile_async_009
* @tc.name fileIO_test_moveFile_async_009
* @tc.desc Test moveFile() interface. Promise.
* @tc.desc Test moveFile() interface. Promise.
* Entry parameters increase forced movement when mode = 0.
* Entry parameters increase forced movement when mode = 0.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_moveFile_async_009
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_moveFile_async_009
'
,
0
,
async
function
(
done
)
{
...
@@ -497,13 +497,13 @@ export default function fileIOMoveFile() {
...
@@ -497,13 +497,13 @@ export default function fileIOMoveFile() {
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_MOVEFILEASYNC_1000
* @tc.number SUB_DF_FILEIO_MOVEFILE
_
ASYNC_1000
* @tc.name fileIO_test_moveFile_async_010
* @tc.name fileIO_test_moveFile_async_010
* @tc.desc Test moveFile() interface. Callback.
* @tc.desc Test moveFile() interface. Callback.
* Entry parameters increase forced movement when mode = 0.
* Entry parameters increase forced movement when mode = 0.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_moveFile_async_010
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_moveFile_async_010
'
,
0
,
async
function
(
done
)
{
...
...
storage/storagefileiov9jstest/src/main/js/test/members/open.test.js
浏览文件 @
0edfcc10
此差异已折叠。
点击以展开。
storage/storagefileiov9jstest/src/main/js/test/members/read.test.js
浏览文件 @
0edfcc10
此差异已折叠。
点击以展开。
storage/storagefileiov9jstest/src/main/js/test/members/rmdir.test.js
浏览文件 @
0edfcc10
此差异已折叠。
点击以展开。
storage/storagefileiov9jstest/src/main/js/test/members/stat.test.js
浏览文件 @
0edfcc10
此差异已折叠。
点击以展开。
storage/storagefileiov9jstest/src/main/js/test/members/symlink.test.js
浏览文件 @
0edfcc10
...
@@ -52,7 +52,7 @@ describe('fileIO_fs_symlink', function () {
...
@@ -52,7 +52,7 @@ describe('fileIO_fs_symlink', function () {
* Missing parameter.
* Missing parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Functoin
* @tc.type Functoin
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_symlink_sync_001
'
,
0
,
async
function
()
{
it
(
'
fileIO_test_symlink_sync_001
'
,
0
,
async
function
()
{
...
@@ -84,10 +84,10 @@ describe('fileIO_fs_symlink', function () {
...
@@ -84,10 +84,10 @@ describe('fileIO_fs_symlink', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
fileIO
.
symlink
(
fpath
,
fpath
+
'
link
3
'
).
then
(()
=>
{
fileIO
.
symlink
(
fpath
,
fpath
+
'
link
1
'
).
then
(()
=>
{
expect
(
fileIO
.
accessSync
(
fpath
+
'
link
3
'
)).
assertTrue
();
expect
(
fileIO
.
accessSync
(
fpath
+
'
link
1
'
)).
assertTrue
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
+
'
link
3
'
);
fileIO
.
unlinkSync
(
fpath
+
'
link
1
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
fileIO_test_symlink_async_000 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_symlink_async_000 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
...
@@ -106,7 +106,7 @@ describe('fileIO_fs_symlink', function () {
...
@@ -106,7 +106,7 @@ describe('fileIO_fs_symlink', function () {
* Create a symbolic link to verify normal function.
* Create a symbolic link to verify normal function.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Functoin
* @tc.type Functoin
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_symlink_async_001
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_symlink_async_001
'
,
0
,
async
function
(
done
)
{
...
@@ -114,10 +114,10 @@ describe('fileIO_fs_symlink', function () {
...
@@ -114,10 +114,10 @@ describe('fileIO_fs_symlink', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
await
fileIO
.
symlink
(
fpath
,
fpath
+
'
link
4
'
);
await
fileIO
.
symlink
(
fpath
,
fpath
+
'
link
2
'
);
expect
(
fileIO
.
accessSync
(
fpath
+
'
link
4
'
)).
assertTrue
();
expect
(
fileIO
.
accessSync
(
fpath
+
'
link
2
'
)).
assertTrue
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
+
'
link
4
'
);
fileIO
.
unlinkSync
(
fpath
+
'
link
2
'
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_symlink_async_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_symlink_async_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
@@ -132,7 +132,7 @@ describe('fileIO_fs_symlink', function () {
...
@@ -132,7 +132,7 @@ describe('fileIO_fs_symlink', function () {
* Create a symbolic link to verify normal function.
* Create a symbolic link to verify normal function.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Functoin
* @tc.type Functoin
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_symlink_async_002
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_symlink_async_002
'
,
0
,
async
function
(
done
)
{
...
@@ -140,14 +140,14 @@ describe('fileIO_fs_symlink', function () {
...
@@ -140,14 +140,14 @@ describe('fileIO_fs_symlink', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
fileIO
.
symlink
(
fpath
,
fpath
+
'
link
5
'
,
(
err
)
=>
{
fileIO
.
symlink
(
fpath
,
fpath
+
'
link
3
'
,
(
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_symlink_async_002 error package:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_symlink_async_002 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
expect
(
fileIO
.
accessSync
(
fpath
+
'
link
5
'
)).
assertTrue
();
expect
(
fileIO
.
accessSync
(
fpath
+
'
link
3
'
)).
assertTrue
();
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
);
fileIO
.
unlinkSync
(
fpath
+
'
link
5
'
);
fileIO
.
unlinkSync
(
fpath
+
'
link
3
'
);
done
();
done
();
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -163,7 +163,7 @@ describe('fileIO_fs_symlink', function () {
...
@@ -163,7 +163,7 @@ describe('fileIO_fs_symlink', function () {
* Missing parameter.
* Missing parameter.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Functoin
* @tc.type Functoin
* @tc.level Level
0
* @tc.level Level
3
* @tc.require
* @tc.require
*/
*/
it
(
'
fileIO_test_symlink_async_003
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_symlink_async_003
'
,
0
,
async
function
(
done
)
{
...
...
storage/storagefileiov9jstest/src/main/js/test/members/truncate.test.js
浏览文件 @
0edfcc10
此差异已折叠。
点击以展开。
storage/storagefileiov9jstest/src/main/js/test/members/unlink.test.js
浏览文件 @
0edfcc10
此差异已折叠。
点击以展开。
storage/storagefileiov9jstest/src/main/js/test/members/write.test.js
浏览文件 @
0edfcc10
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录