Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8426cc89
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看板
提交
8426cc89
编写于
7月 16, 2021
作者:
M
maokelong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update test cases for module fileio
Signed-off-by:
N
maokelong
<
chenjinglong1@huawei.com
>
上级
eb2f7c2a
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
69 addition
and
69 deletion
+69
-69
distributeddatamgr/distributedfilejstest/hap/entry-debug-rich-signed.hap
...mgr/distributedfilejstest/hap/entry-debug-rich-signed.hap
+0
-0
distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIO.test.js
...dfilejstest/project/entry/src/main/js/test/FileIO.test.js
+4
-4
distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIODir.test.js
...lejstest/project/entry/src/main/js/test/FileIODir.test.js
+5
-5
distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIODirent.test.js
...stest/project/entry/src/main/js/test/FileIODirent.test.js
+15
-15
distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIOStat.test.js
...ejstest/project/entry/src/main/js/test/FileIOStat.test.js
+37
-37
distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIOStream.test.js
...stest/project/entry/src/main/js/test/FileIOStream.test.js
+8
-8
未找到文件。
distributeddatamgr/distributedfilejstest/hap/entry-debug-rich-signed.hap
浏览文件 @
8426cc89
无法预览此类型文件
distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIO.test.js
浏览文件 @
8426cc89
...
...
@@ -561,7 +561,7 @@ describe('fileIOTest', function () {
try
{
expect
(
fileio
.
chmodSync
(
fpath
,
0o660
)).
assertNull
()
expect
(
fileio
.
Stat
.
statSync
(
fpath
).
mode
&
0o777
).
assertEqual
(
0o660
)
expect
(
fileio
.
statSync
(
fpath
).
mode
&
0o777
).
assertEqual
(
0o660
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
console
.
log
(
"
fileio_test_chmod_sync_000 has failed for
"
+
e
)
...
...
@@ -661,7 +661,7 @@ describe('fileIOTest', function () {
try
{
expect
(
fileio
.
truncateSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
Stat
.
statSync
(
fpath
).
size
).
assertEqual
(
0
)
expect
(
fileio
.
statSync
(
fpath
).
size
).
assertEqual
(
0
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
console
.
log
(
"
fileio_test_truncate_sync_000 has failed for
"
+
e
)
...
...
@@ -761,7 +761,7 @@ describe('fileIOTest', function () {
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o2
)
expect
(
fileio
.
fchmodSync
(
fd
,
0o660
)).
assertNull
()
expect
(
fileio
.
Stat
.
statSync
(
fpath
).
mode
&
0o777
).
assertEqual
(
0o660
)
expect
(
fileio
.
statSync
(
fpath
).
mode
&
0o777
).
assertEqual
(
0o660
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
console
.
log
(
"
fileio_test_fchmod_sync_000 has failed for
"
+
e
)
...
...
@@ -794,7 +794,7 @@ describe('fileIOTest', function () {
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o2
)
expect
(
fileio
.
ftruncateSync
(
fd
)).
assertNull
()
expect
(
fileio
.
Stat
.
statSync
(
fpath
).
size
).
assertEqual
(
0
)
expect
(
fileio
.
statSync
(
fpath
).
size
).
assertEqual
(
0
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
console
.
log
(
"
fileio_test_ftruncate_sync_000 has failed for
"
+
e
)
...
...
distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIODir.test.js
浏览文件 @
8426cc89
...
...
@@ -29,7 +29,7 @@ describe('fileIOTestDir', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
.
closeSync
()).
assertNull
()
expect
(
fileio
.
rmdirSync
(
dpath
)).
assertNull
()
...
...
@@ -46,7 +46,7 @@ describe('fileIOTestDir', function () {
*/
it
(
'
fileio_test_dir_open_close_sync_001
'
,
0
,
function
()
{
try
{
fileio
.
Dir
.
opendirSync
()
fileio
.
opendirSync
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
...
...
@@ -61,7 +61,7 @@ describe('fileIOTestDir', function () {
let
dpath
=
nextFileName
(
'
fileio_test_dir_read_sync_000
'
)
+
'
d
'
try
{
fileio
.
Dir
.
opendirSync
(
dpath
)
fileio
.
opendirSync
(
dpath
)
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
...
...
@@ -79,7 +79,7 @@ describe('fileIOTestDir', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
.
readSync
()
!=
null
).
assertTrue
()
expect
(
dd
.
closeSync
()).
assertNull
()
...
...
@@ -105,7 +105,7 @@ describe('fileIOTestDir', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
.
readSync
(
-
1
)
!=
null
).
assertTrue
()
expect
(
null
).
assertFail
()
...
...
distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIODirent.test.js
浏览文件 @
8426cc89
...
...
@@ -31,7 +31,7 @@ describe('fileIOTestDirent', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
@@ -57,7 +57,7 @@ describe('fileIOTestDirent', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
@@ -84,7 +84,7 @@ describe('fileIOTestDirent', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
@@ -109,7 +109,7 @@ describe('fileIOTestDirent', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
@@ -136,7 +136,7 @@ describe('fileIOTestDirent', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
@@ -161,7 +161,7 @@ describe('fileIOTestDirent', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
@@ -188,7 +188,7 @@ describe('fileIOTestDirent', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
@@ -213,7 +213,7 @@ describe('fileIOTestDirent', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
@@ -240,7 +240,7 @@ describe('fileIOTestDirent', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
@@ -265,7 +265,7 @@ describe('fileIOTestDirent', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
@@ -292,7 +292,7 @@ describe('fileIOTestDirent', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
@@ -317,7 +317,7 @@ describe('fileIOTestDirent', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
@@ -344,7 +344,7 @@ describe('fileIOTestDirent', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
@@ -369,7 +369,7 @@ describe('fileIOTestDirent', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
@@ -396,7 +396,7 @@ describe('fileIOTestDirent', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIOStat.test.js
浏览文件 @
8426cc89
...
...
@@ -65,7 +65,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
!==
null
).
assertTrue
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -83,7 +83,7 @@ describe('fileIOTestStat', function () {
let
fpath
=
nextFileName
(
'
fileio_test_stat_stat_sync_001
'
)
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
...
...
@@ -99,7 +99,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
dev
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -118,7 +118,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
ino
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -137,7 +137,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
mode
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -156,7 +156,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
nlink
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -175,7 +175,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
uid
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -194,7 +194,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
gid
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -213,7 +213,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
rdev
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -232,7 +232,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
size
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -251,7 +251,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
blocks
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -270,7 +270,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
atime
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -289,7 +289,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
mtime
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -308,7 +308,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
ctime
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -327,7 +327,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isBlockDevice
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -346,7 +346,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isBlockDevice
()).
assertFalse
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -365,7 +365,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isBlockDevice
(
-
1
)).
assertFalse
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
...
...
@@ -383,7 +383,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isCharacterDevice
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -402,7 +402,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isCharacterDevice
()).
assertFalse
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -421,7 +421,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isCharacterDevice
(
-
1
)).
assertFalse
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
...
...
@@ -439,7 +439,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isDirectory
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -458,7 +458,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isDirectory
()).
assertFalse
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -477,7 +477,7 @@ describe('fileIOTestStat', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
let
stat
=
fileio
.
Stat
.
statSync
(
dpath
)
let
stat
=
fileio
.
statSync
(
dpath
)
expect
(
stat
.
isDirectory
()).
assertTrue
()
expect
(
fileio
.
rmdirSync
(
dpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -496,7 +496,7 @@ describe('fileIOTestStat', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
let
stat
=
fileio
.
Stat
.
statSync
(
dpath
)
let
stat
=
fileio
.
statSync
(
dpath
)
expect
(
stat
.
isDirectory
(
-
1
)).
assertTrue
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
...
...
@@ -514,7 +514,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isFIFO
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -533,7 +533,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isFIFO
()).
assertFalse
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -552,7 +552,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isFIFO
(
-
1
)).
assertFalse
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
...
...
@@ -570,7 +570,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertInstanceOf
(
'
Boolean
'
)
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isFile
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -589,7 +589,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertInstanceOf
(
'
Boolean
'
)
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isFile
()).
assertTrue
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -608,7 +608,7 @@ describe('fileIOTestStat', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
let
stat
=
fileio
.
Stat
.
statSync
(
dpath
)
let
stat
=
fileio
.
statSync
(
dpath
)
expect
(
stat
.
isFile
()).
assertFalse
()
expect
(
fileio
.
rmdirSync
(
dpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -627,7 +627,7 @@ describe('fileIOTestStat', function () {
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
let
stat
=
fileio
.
Stat
.
statSync
(
dpath
)
let
stat
=
fileio
.
statSync
(
dpath
)
expect
(
stat
.
isFile
(
-
1
)).
assertFalse
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
...
...
@@ -645,7 +645,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isSocket
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -664,7 +664,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isSocket
()).
assertFalse
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -683,7 +683,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isSocket
(
-
1
)).
assertFalse
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
...
...
@@ -701,7 +701,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isSymbolicLink
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -720,7 +720,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isSymbolicLink
()).
assertFalse
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
...
...
@@ -739,7 +739,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isSymbolicLink
(
-
1
)).
assertFalse
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
...
...
distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIOStream.test.js
浏览文件 @
8426cc89
...
...
@@ -29,7 +29,7 @@ describe('fileIOTestStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
var
ss
=
fileio
.
Stream
.
createStreamSync
(
fpath
,
"
r+
"
)
var
ss
=
fileio
.
createStreamSync
(
fpath
,
"
r+
"
)
expect
(
ss
!==
null
).
assertTrue
()
expect
(
ss
.
closeSync
()).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
...
...
@@ -48,7 +48,7 @@ describe('fileIOTestStream', function () {
let
fpath
=
nextFileName
(
'
fileio_test_stream_create_stream_sync_001
'
)
try
{
fileio
.
Stream
.
createStreamSync
(
fpath
,
"
r+
"
)
fileio
.
createStreamSync
(
fpath
,
"
r+
"
)
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
...
...
@@ -64,7 +64,7 @@ describe('fileIOTestStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
fileio
.
Stream
.
createStreamSync
(
fpath
,
"
ohos
"
)
fileio
.
createStreamSync
(
fpath
,
"
ohos
"
)
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
...
...
@@ -82,7 +82,7 @@ describe('fileIOTestStream', function () {
try
{
var
fd
=
fileio
.
openSync
(
fpath
,
0o2
)
let
ss
=
fileio
.
Stream
.
fdopenStreamSync
(
fd
,
"
r+
"
)
let
ss
=
fileio
.
fdopenStreamSync
(
fd
,
"
r+
"
)
expect
(
ss
!==
null
).
assertTrue
()
expect
(
ss
.
closeSync
()).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
...
...
@@ -99,7 +99,7 @@ describe('fileIOTestStream', function () {
*/
it
(
'
fileio_test_stream_fdopen_stream_sync_001
'
,
0
,
function
()
{
try
{
let
ss
=
fileio
.
Stream
.
fdopenStreamSync
(
-
1
,
"
r+
"
)
let
ss
=
fileio
.
fdopenStreamSync
(
-
1
,
"
r+
"
)
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
...
...
@@ -115,7 +115,7 @@ describe('fileIOTestStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
ss
=
fileio
.
Stream
.
createStreamSync
(
fpath
,
"
r+
"
)
let
ss
=
fileio
.
createStreamSync
(
fpath
,
"
r+
"
)
expect
(
ss
!==
null
).
assertTrue
()
let
len
=
ss
.
readSync
(
new
ArrayBuffer
(
4096
))
expect
(
len
).
assertEqual
(
FILE_CONTENT
.
length
)
...
...
@@ -137,7 +137,7 @@ describe('fileIOTestStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
ss
=
fileio
.
Stream
.
createStreamSync
(
fpath
,
"
r+
"
)
let
ss
=
fileio
.
createStreamSync
(
fpath
,
"
r+
"
)
expect
(
ss
!==
null
).
assertTrue
()
expect
(
ss
.
writeSync
(
FILE_CONTENT
)).
assertEqual
(
FILE_CONTENT
.
length
)
expect
(
ss
.
closeSync
()).
assertNull
()
...
...
@@ -158,7 +158,7 @@ describe('fileIOTestStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
let
ss
=
fileio
.
Stream
.
createStreamSync
(
fpath
,
"
r+
"
)
let
ss
=
fileio
.
createStreamSync
(
fpath
,
"
r+
"
)
expect
(
ss
!==
null
).
assertTrue
()
expect
(
ss
.
writeSync
(
FILE_CONTENT
)).
assertEqual
(
FILE_CONTENT
.
length
)
expect
(
ss
.
flushSync
()).
assertNull
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录