Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
befeeda4
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看板
提交
befeeda4
编写于
7月 20, 2021
作者:
O
openharmony_ci
提交者:
Gitee
7月 20, 2021
浏览文件
操作
浏览文件
下载
差异文件
!326 FILEIO部分接口实现与定义不符,此处予以修正
Merge pull request !326 from 猫科龙/master
上级
c8ab760f
8426cc89
变更
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
浏览文件 @
befeeda4
无法预览此类型文件
distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIO.test.js
浏览文件 @
befeeda4
...
@@ -561,7 +561,7 @@ describe('fileIOTest', function () {
...
@@ -561,7 +561,7 @@ describe('fileIOTest', function () {
try
{
try
{
expect
(
fileio
.
chmodSync
(
fpath
,
0o660
)).
assertNull
()
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
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
"
fileio_test_chmod_sync_000 has failed for
"
+
e
)
console
.
log
(
"
fileio_test_chmod_sync_000 has failed for
"
+
e
)
...
@@ -661,7 +661,7 @@ describe('fileIOTest', function () {
...
@@ -661,7 +661,7 @@ describe('fileIOTest', function () {
try
{
try
{
expect
(
fileio
.
truncateSync
(
fpath
)).
assertNull
()
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
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
"
fileio_test_truncate_sync_000 has failed for
"
+
e
)
console
.
log
(
"
fileio_test_truncate_sync_000 has failed for
"
+
e
)
...
@@ -761,7 +761,7 @@ describe('fileIOTest', function () {
...
@@ -761,7 +761,7 @@ describe('fileIOTest', function () {
try
{
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o2
)
let
fd
=
fileio
.
openSync
(
fpath
,
0o2
)
expect
(
fileio
.
fchmodSync
(
fd
,
0o660
)).
assertNull
()
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
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
"
fileio_test_fchmod_sync_000 has failed for
"
+
e
)
console
.
log
(
"
fileio_test_fchmod_sync_000 has failed for
"
+
e
)
...
@@ -794,7 +794,7 @@ describe('fileIOTest', function () {
...
@@ -794,7 +794,7 @@ describe('fileIOTest', function () {
try
{
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o2
)
let
fd
=
fileio
.
openSync
(
fpath
,
0o2
)
expect
(
fileio
.
ftruncateSync
(
fd
)).
assertNull
()
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
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
"
fileio_test_ftruncate_sync_000 has failed for
"
+
e
)
console
.
log
(
"
fileio_test_ftruncate_sync_000 has failed for
"
+
e
)
...
...
distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIODir.test.js
浏览文件 @
befeeda4
...
@@ -29,7 +29,7 @@ describe('fileIOTestDir', function () {
...
@@ -29,7 +29,7 @@ describe('fileIOTestDir', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
.
closeSync
()).
assertNull
()
expect
(
dd
.
closeSync
()).
assertNull
()
expect
(
fileio
.
rmdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
rmdirSync
(
dpath
)).
assertNull
()
...
@@ -46,7 +46,7 @@ describe('fileIOTestDir', function () {
...
@@ -46,7 +46,7 @@ describe('fileIOTestDir', function () {
*/
*/
it
(
'
fileio_test_dir_open_close_sync_001
'
,
0
,
function
()
{
it
(
'
fileio_test_dir_open_close_sync_001
'
,
0
,
function
()
{
try
{
try
{
fileio
.
Dir
.
opendirSync
()
fileio
.
opendirSync
()
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
catch
(
e
)
{
}
}
...
@@ -61,7 +61,7 @@ describe('fileIOTestDir', function () {
...
@@ -61,7 +61,7 @@ describe('fileIOTestDir', function () {
let
dpath
=
nextFileName
(
'
fileio_test_dir_read_sync_000
'
)
+
'
d
'
let
dpath
=
nextFileName
(
'
fileio_test_dir_read_sync_000
'
)
+
'
d
'
try
{
try
{
fileio
.
Dir
.
opendirSync
(
dpath
)
fileio
.
opendirSync
(
dpath
)
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
catch
(
e
)
{
}
}
...
@@ -79,7 +79,7 @@ describe('fileIOTestDir', function () {
...
@@ -79,7 +79,7 @@ describe('fileIOTestDir', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
.
readSync
()
!=
null
).
assertTrue
()
expect
(
dd
.
readSync
()
!=
null
).
assertTrue
()
expect
(
dd
.
closeSync
()).
assertNull
()
expect
(
dd
.
closeSync
()).
assertNull
()
...
@@ -105,7 +105,7 @@ describe('fileIOTestDir', function () {
...
@@ -105,7 +105,7 @@ describe('fileIOTestDir', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
.
readSync
(
-
1
)
!=
null
).
assertTrue
()
expect
(
dd
.
readSync
(
-
1
)
!=
null
).
assertTrue
()
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
...
...
distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIODirent.test.js
浏览文件 @
befeeda4
...
@@ -31,7 +31,7 @@ describe('fileIOTestDirent', function () {
...
@@ -31,7 +31,7 @@ describe('fileIOTestDirent', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
expect
(
dirent
!==
null
).
assertTrue
()
...
@@ -57,7 +57,7 @@ describe('fileIOTestDirent', function () {
...
@@ -57,7 +57,7 @@ describe('fileIOTestDirent', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
expect
(
dirent
!==
null
).
assertTrue
()
...
@@ -84,7 +84,7 @@ describe('fileIOTestDirent', function () {
...
@@ -84,7 +84,7 @@ describe('fileIOTestDirent', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
expect
(
dirent
!==
null
).
assertTrue
()
...
@@ -109,7 +109,7 @@ describe('fileIOTestDirent', function () {
...
@@ -109,7 +109,7 @@ describe('fileIOTestDirent', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
expect
(
dirent
!==
null
).
assertTrue
()
...
@@ -136,7 +136,7 @@ describe('fileIOTestDirent', function () {
...
@@ -136,7 +136,7 @@ describe('fileIOTestDirent', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
expect
(
dirent
!==
null
).
assertTrue
()
...
@@ -161,7 +161,7 @@ describe('fileIOTestDirent', function () {
...
@@ -161,7 +161,7 @@ describe('fileIOTestDirent', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
expect
(
dirent
!==
null
).
assertTrue
()
...
@@ -188,7 +188,7 @@ describe('fileIOTestDirent', function () {
...
@@ -188,7 +188,7 @@ describe('fileIOTestDirent', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
expect
(
dirent
!==
null
).
assertTrue
()
...
@@ -213,7 +213,7 @@ describe('fileIOTestDirent', function () {
...
@@ -213,7 +213,7 @@ describe('fileIOTestDirent', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
expect
(
dirent
!==
null
).
assertTrue
()
...
@@ -240,7 +240,7 @@ describe('fileIOTestDirent', function () {
...
@@ -240,7 +240,7 @@ describe('fileIOTestDirent', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
expect
(
dirent
!==
null
).
assertTrue
()
...
@@ -265,7 +265,7 @@ describe('fileIOTestDirent', function () {
...
@@ -265,7 +265,7 @@ describe('fileIOTestDirent', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
expect
(
dirent
!==
null
).
assertTrue
()
...
@@ -292,7 +292,7 @@ describe('fileIOTestDirent', function () {
...
@@ -292,7 +292,7 @@ describe('fileIOTestDirent', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
expect
(
dirent
!==
null
).
assertTrue
()
...
@@ -317,7 +317,7 @@ describe('fileIOTestDirent', function () {
...
@@ -317,7 +317,7 @@ describe('fileIOTestDirent', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
expect
(
dirent
!==
null
).
assertTrue
()
...
@@ -344,7 +344,7 @@ describe('fileIOTestDirent', function () {
...
@@ -344,7 +344,7 @@ describe('fileIOTestDirent', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
expect
(
dirent
!==
null
).
assertTrue
()
...
@@ -369,7 +369,7 @@ describe('fileIOTestDirent', function () {
...
@@ -369,7 +369,7 @@ describe('fileIOTestDirent', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
let
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
let
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
expect
(
dirent
!==
null
).
assertTrue
()
...
@@ -396,7 +396,7 @@ describe('fileIOTestDirent', function () {
...
@@ -396,7 +396,7 @@ describe('fileIOTestDirent', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
dd
=
fileio
.
Dir
.
opendirSync
(
dpath
)
dd
=
fileio
.
opendirSync
(
dpath
)
expect
(
dd
!==
null
).
assertTrue
()
expect
(
dd
!==
null
).
assertTrue
()
let
dirent
=
dd
.
readSync
()
let
dirent
=
dd
.
readSync
()
expect
(
dirent
!==
null
).
assertTrue
()
expect
(
dirent
!==
null
).
assertTrue
()
...
...
distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIOStat.test.js
浏览文件 @
befeeda4
...
@@ -65,7 +65,7 @@ describe('fileIOTestStat', function () {
...
@@ -65,7 +65,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
!==
null
).
assertTrue
()
expect
(
stat
!==
null
).
assertTrue
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -83,7 +83,7 @@ describe('fileIOTestStat', function () {
...
@@ -83,7 +83,7 @@ describe('fileIOTestStat', function () {
let
fpath
=
nextFileName
(
'
fileio_test_stat_stat_sync_001
'
)
let
fpath
=
nextFileName
(
'
fileio_test_stat_stat_sync_001
'
)
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
catch
(
e
)
{
}
}
...
@@ -99,7 +99,7 @@ describe('fileIOTestStat', function () {
...
@@ -99,7 +99,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
dev
).
assertInstanceOf
(
'
Number
'
)
expect
(
stat
.
dev
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -118,7 +118,7 @@ describe('fileIOTestStat', function () {
...
@@ -118,7 +118,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
ino
).
assertInstanceOf
(
'
Number
'
)
expect
(
stat
.
ino
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -137,7 +137,7 @@ describe('fileIOTestStat', function () {
...
@@ -137,7 +137,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
mode
).
assertInstanceOf
(
'
Number
'
)
expect
(
stat
.
mode
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -156,7 +156,7 @@ describe('fileIOTestStat', function () {
...
@@ -156,7 +156,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
nlink
).
assertInstanceOf
(
'
Number
'
)
expect
(
stat
.
nlink
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -175,7 +175,7 @@ describe('fileIOTestStat', function () {
...
@@ -175,7 +175,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
uid
).
assertInstanceOf
(
'
Number
'
)
expect
(
stat
.
uid
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -194,7 +194,7 @@ describe('fileIOTestStat', function () {
...
@@ -194,7 +194,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
gid
).
assertInstanceOf
(
'
Number
'
)
expect
(
stat
.
gid
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -213,7 +213,7 @@ describe('fileIOTestStat', function () {
...
@@ -213,7 +213,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
rdev
).
assertInstanceOf
(
'
Number
'
)
expect
(
stat
.
rdev
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -232,7 +232,7 @@ describe('fileIOTestStat', function () {
...
@@ -232,7 +232,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
size
).
assertInstanceOf
(
'
Number
'
)
expect
(
stat
.
size
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -251,7 +251,7 @@ describe('fileIOTestStat', function () {
...
@@ -251,7 +251,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
blocks
).
assertInstanceOf
(
'
Number
'
)
expect
(
stat
.
blocks
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -270,7 +270,7 @@ describe('fileIOTestStat', function () {
...
@@ -270,7 +270,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
atime
).
assertInstanceOf
(
'
Number
'
)
expect
(
stat
.
atime
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -289,7 +289,7 @@ describe('fileIOTestStat', function () {
...
@@ -289,7 +289,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
mtime
).
assertInstanceOf
(
'
Number
'
)
expect
(
stat
.
mtime
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -308,7 +308,7 @@ describe('fileIOTestStat', function () {
...
@@ -308,7 +308,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
ctime
).
assertInstanceOf
(
'
Number
'
)
expect
(
stat
.
ctime
).
assertInstanceOf
(
'
Number
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -327,7 +327,7 @@ describe('fileIOTestStat', function () {
...
@@ -327,7 +327,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isBlockDevice
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
stat
.
isBlockDevice
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -346,7 +346,7 @@ describe('fileIOTestStat', function () {
...
@@ -346,7 +346,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isBlockDevice
()).
assertFalse
()
expect
(
stat
.
isBlockDevice
()).
assertFalse
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -365,7 +365,7 @@ describe('fileIOTestStat', function () {
...
@@ -365,7 +365,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isBlockDevice
(
-
1
)).
assertFalse
()
expect
(
stat
.
isBlockDevice
(
-
1
)).
assertFalse
()
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -383,7 +383,7 @@ describe('fileIOTestStat', function () {
...
@@ -383,7 +383,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isCharacterDevice
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
stat
.
isCharacterDevice
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -402,7 +402,7 @@ describe('fileIOTestStat', function () {
...
@@ -402,7 +402,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isCharacterDevice
()).
assertFalse
()
expect
(
stat
.
isCharacterDevice
()).
assertFalse
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -421,7 +421,7 @@ describe('fileIOTestStat', function () {
...
@@ -421,7 +421,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isCharacterDevice
(
-
1
)).
assertFalse
()
expect
(
stat
.
isCharacterDevice
(
-
1
)).
assertFalse
()
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -439,7 +439,7 @@ describe('fileIOTestStat', function () {
...
@@ -439,7 +439,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isDirectory
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
stat
.
isDirectory
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -458,7 +458,7 @@ describe('fileIOTestStat', function () {
...
@@ -458,7 +458,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isDirectory
()).
assertFalse
()
expect
(
stat
.
isDirectory
()).
assertFalse
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -477,7 +477,7 @@ describe('fileIOTestStat', function () {
...
@@ -477,7 +477,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
let
stat
=
fileio
.
Stat
.
statSync
(
dpath
)
let
stat
=
fileio
.
statSync
(
dpath
)
expect
(
stat
.
isDirectory
()).
assertTrue
()
expect
(
stat
.
isDirectory
()).
assertTrue
()
expect
(
fileio
.
rmdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
rmdirSync
(
dpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -496,7 +496,7 @@ describe('fileIOTestStat', function () {
...
@@ -496,7 +496,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
let
stat
=
fileio
.
Stat
.
statSync
(
dpath
)
let
stat
=
fileio
.
statSync
(
dpath
)
expect
(
stat
.
isDirectory
(
-
1
)).
assertTrue
()
expect
(
stat
.
isDirectory
(
-
1
)).
assertTrue
()
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -514,7 +514,7 @@ describe('fileIOTestStat', function () {
...
@@ -514,7 +514,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isFIFO
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
stat
.
isFIFO
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -533,7 +533,7 @@ describe('fileIOTestStat', function () {
...
@@ -533,7 +533,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isFIFO
()).
assertFalse
()
expect
(
stat
.
isFIFO
()).
assertFalse
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -552,7 +552,7 @@ describe('fileIOTestStat', function () {
...
@@ -552,7 +552,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isFIFO
(
-
1
)).
assertFalse
()
expect
(
stat
.
isFIFO
(
-
1
)).
assertFalse
()
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -570,7 +570,7 @@ describe('fileIOTestStat', function () {
...
@@ -570,7 +570,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertInstanceOf
(
'
Boolean
'
)
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertInstanceOf
(
'
Boolean
'
)
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isFile
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
stat
.
isFile
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -589,7 +589,7 @@ describe('fileIOTestStat', function () {
...
@@ -589,7 +589,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertInstanceOf
(
'
Boolean
'
)
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertInstanceOf
(
'
Boolean
'
)
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isFile
()).
assertTrue
()
expect
(
stat
.
isFile
()).
assertTrue
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -608,7 +608,7 @@ describe('fileIOTestStat', function () {
...
@@ -608,7 +608,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
let
stat
=
fileio
.
Stat
.
statSync
(
dpath
)
let
stat
=
fileio
.
statSync
(
dpath
)
expect
(
stat
.
isFile
()).
assertFalse
()
expect
(
stat
.
isFile
()).
assertFalse
()
expect
(
fileio
.
rmdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
rmdirSync
(
dpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -627,7 +627,7 @@ describe('fileIOTestStat', function () {
...
@@ -627,7 +627,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
expect
(
fileio
.
mkdirSync
(
dpath
)).
assertNull
()
let
stat
=
fileio
.
Stat
.
statSync
(
dpath
)
let
stat
=
fileio
.
statSync
(
dpath
)
expect
(
stat
.
isFile
(
-
1
)).
assertFalse
()
expect
(
stat
.
isFile
(
-
1
)).
assertFalse
()
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -645,7 +645,7 @@ describe('fileIOTestStat', function () {
...
@@ -645,7 +645,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isSocket
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
stat
.
isSocket
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -664,7 +664,7 @@ describe('fileIOTestStat', function () {
...
@@ -664,7 +664,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isSocket
()).
assertFalse
()
expect
(
stat
.
isSocket
()).
assertFalse
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -683,7 +683,7 @@ describe('fileIOTestStat', function () {
...
@@ -683,7 +683,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isSocket
(
-
1
)).
assertFalse
()
expect
(
stat
.
isSocket
(
-
1
)).
assertFalse
()
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -701,7 +701,7 @@ describe('fileIOTestStat', function () {
...
@@ -701,7 +701,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isSymbolicLink
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
stat
.
isSymbolicLink
()).
assertInstanceOf
(
'
Boolean
'
)
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -720,7 +720,7 @@ describe('fileIOTestStat', function () {
...
@@ -720,7 +720,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isSymbolicLink
()).
assertFalse
()
expect
(
stat
.
isSymbolicLink
()).
assertFalse
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -739,7 +739,7 @@ describe('fileIOTestStat', function () {
...
@@ -739,7 +739,7 @@ describe('fileIOTestStat', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
stat
=
fileio
.
Stat
.
statSync
(
fpath
)
let
stat
=
fileio
.
statSync
(
fpath
)
expect
(
stat
.
isSymbolicLink
(
-
1
)).
assertFalse
()
expect
(
stat
.
isSymbolicLink
(
-
1
)).
assertFalse
()
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
catch
(
e
)
{
...
...
distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIOStream.test.js
浏览文件 @
befeeda4
...
@@ -29,7 +29,7 @@ describe('fileIOTestStream', function () {
...
@@ -29,7 +29,7 @@ describe('fileIOTestStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
var
ss
=
fileio
.
Stream
.
createStreamSync
(
fpath
,
"
r+
"
)
var
ss
=
fileio
.
createStreamSync
(
fpath
,
"
r+
"
)
expect
(
ss
!==
null
).
assertTrue
()
expect
(
ss
!==
null
).
assertTrue
()
expect
(
ss
.
closeSync
()).
assertNull
()
expect
(
ss
.
closeSync
()).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
...
@@ -48,7 +48,7 @@ describe('fileIOTestStream', function () {
...
@@ -48,7 +48,7 @@ describe('fileIOTestStream', function () {
let
fpath
=
nextFileName
(
'
fileio_test_stream_create_stream_sync_001
'
)
let
fpath
=
nextFileName
(
'
fileio_test_stream_create_stream_sync_001
'
)
try
{
try
{
fileio
.
Stream
.
createStreamSync
(
fpath
,
"
r+
"
)
fileio
.
createStreamSync
(
fpath
,
"
r+
"
)
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
catch
(
e
)
{
}
}
...
@@ -64,7 +64,7 @@ describe('fileIOTestStream', function () {
...
@@ -64,7 +64,7 @@ describe('fileIOTestStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
fileio
.
Stream
.
createStreamSync
(
fpath
,
"
ohos
"
)
fileio
.
createStreamSync
(
fpath
,
"
ohos
"
)
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
...
@@ -82,7 +82,7 @@ describe('fileIOTestStream', function () {
...
@@ -82,7 +82,7 @@ describe('fileIOTestStream', function () {
try
{
try
{
var
fd
=
fileio
.
openSync
(
fpath
,
0o2
)
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
!==
null
).
assertTrue
()
expect
(
ss
.
closeSync
()).
assertNull
()
expect
(
ss
.
closeSync
()).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
expect
(
fileio
.
unlinkSync
(
fpath
)).
assertNull
()
...
@@ -99,7 +99,7 @@ describe('fileIOTestStream', function () {
...
@@ -99,7 +99,7 @@ describe('fileIOTestStream', function () {
*/
*/
it
(
'
fileio_test_stream_fdopen_stream_sync_001
'
,
0
,
function
()
{
it
(
'
fileio_test_stream_fdopen_stream_sync_001
'
,
0
,
function
()
{
try
{
try
{
let
ss
=
fileio
.
Stream
.
fdopenStreamSync
(
-
1
,
"
r+
"
)
let
ss
=
fileio
.
fdopenStreamSync
(
-
1
,
"
r+
"
)
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}
catch
(
e
)
{
}
catch
(
e
)
{
}
}
...
@@ -115,7 +115,7 @@ describe('fileIOTestStream', function () {
...
@@ -115,7 +115,7 @@ describe('fileIOTestStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
ss
=
fileio
.
Stream
.
createStreamSync
(
fpath
,
"
r+
"
)
let
ss
=
fileio
.
createStreamSync
(
fpath
,
"
r+
"
)
expect
(
ss
!==
null
).
assertTrue
()
expect
(
ss
!==
null
).
assertTrue
()
let
len
=
ss
.
readSync
(
new
ArrayBuffer
(
4096
))
let
len
=
ss
.
readSync
(
new
ArrayBuffer
(
4096
))
expect
(
len
).
assertEqual
(
FILE_CONTENT
.
length
)
expect
(
len
).
assertEqual
(
FILE_CONTENT
.
length
)
...
@@ -137,7 +137,7 @@ describe('fileIOTestStream', function () {
...
@@ -137,7 +137,7 @@ describe('fileIOTestStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
ss
=
fileio
.
Stream
.
createStreamSync
(
fpath
,
"
r+
"
)
let
ss
=
fileio
.
createStreamSync
(
fpath
,
"
r+
"
)
expect
(
ss
!==
null
).
assertTrue
()
expect
(
ss
!==
null
).
assertTrue
()
expect
(
ss
.
writeSync
(
FILE_CONTENT
)).
assertEqual
(
FILE_CONTENT
.
length
)
expect
(
ss
.
writeSync
(
FILE_CONTENT
)).
assertEqual
(
FILE_CONTENT
.
length
)
expect
(
ss
.
closeSync
()).
assertNull
()
expect
(
ss
.
closeSync
()).
assertNull
()
...
@@ -158,7 +158,7 @@ describe('fileIOTestStream', function () {
...
@@ -158,7 +158,7 @@ describe('fileIOTestStream', function () {
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
()
try
{
try
{
let
ss
=
fileio
.
Stream
.
createStreamSync
(
fpath
,
"
r+
"
)
let
ss
=
fileio
.
createStreamSync
(
fpath
,
"
r+
"
)
expect
(
ss
!==
null
).
assertTrue
()
expect
(
ss
!==
null
).
assertTrue
()
expect
(
ss
.
writeSync
(
FILE_CONTENT
)).
assertEqual
(
FILE_CONTENT
.
length
)
expect
(
ss
.
writeSync
(
FILE_CONTENT
)).
assertEqual
(
FILE_CONTENT
.
length
)
expect
(
ss
.
flushSync
()).
assertNull
()
expect
(
ss
.
flushSync
()).
assertNull
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录