Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
905cff78
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看板
提交
905cff78
编写于
5月 24, 2022
作者:
R
raoxian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update storagefileiojstest
Signed-off-by:
N
raoxian
<
raoxian@huawei.com
>
上级
a5141467
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
288 addition
and
281 deletion
+288
-281
storage/storagefileiojstest/src/main/js/default/test/FileIODir.test.js
...gefileiojstest/src/main/js/default/test/FileIODir.test.js
+72
-52
storage/storagefileiojstest/src/main/js/default/test/FileIOStat.test.js
...efileiojstest/src/main/js/default/test/FileIOStat.test.js
+50
-61
storage/storagefileiojstest/src/main/js/default/test/FileIOStream.test.js
...ileiojstest/src/main/js/default/test/FileIOStream.test.js
+166
-168
未找到文件。
storage/storagefileiojstest/src/main/js/default/test/FileIODir.test.js
浏览文件 @
905cff78
...
@@ -38,11 +38,11 @@ describe('fileIOTestDir', function () {
...
@@ -38,11 +38,11 @@ describe('fileIOTestDir', function () {
it
(
'
fileio_test_dir_open_sync_000
'
,
0
,
async
function
()
{
it
(
'
fileio_test_dir_open_sync_000
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_open_sync_000
'
)
+
'
d
'
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_open_sync_000
'
)
+
'
d
'
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
let
dd
=
fileio
.
opendirSync
(
dpath
);
let
dd
=
fileio
.
opendirSync
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
expect
(
dd
!==
null
).
assertTrue
();
expect
(
dd
.
closeSync
()
==
null
).
assertTrue
();
dd
.
closeSync
();
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
rmdirSync
(
dpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_open_sync_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_dir_open_sync_000 has failed for
'
+
e
);
...
@@ -71,13 +71,14 @@ describe('fileIOTestDir', function () {
...
@@ -71,13 +71,14 @@ describe('fileIOTestDir', function () {
* @tc.desc Function of API, dpath value is not exist.
* @tc.desc Function of API, dpath value is not exist.
*/
*/
it
(
'
fileio_test_dir_open_sync_002
'
,
0
,
async
function
()
{
it
(
'
fileio_test_dir_open_sync_002
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_open_sync_00
3
'
)
+
'
d
'
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_open_sync_00
2
'
)
+
'
d
'
try
{
try
{
fileio
.
opendirSync
(
dpath
);
fileio
.
opendirSync
(
dpath
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_open_sync_002 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_dir_open_sync_002 has failed for
'
+
e
);
expect
(
e
.
message
==
'
No such file or directory
'
).
assertTrue
();
}
}
});
});
...
@@ -87,7 +88,7 @@ describe('fileIOTestDir', function () {
...
@@ -87,7 +88,7 @@ describe('fileIOTestDir', function () {
* @tc.desc Function of API, dpath too long.
* @tc.desc Function of API, dpath too long.
*/
*/
it
(
'
fileio_test_dir_open_sync_003
'
,
0
,
async
function
()
{
it
(
'
fileio_test_dir_open_sync_003
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileio_
dir11
'
);
let
dpath
=
await
nextFileName
(
'
fileio_
test_dir_open_sync_003
'
);
fileio
.
mkdirSync
(
dpath
);
fileio
.
mkdirSync
(
dpath
);
try
{
try
{
for
(
let
i
=
0
;
i
<
16
;
i
++
)
{
for
(
let
i
=
0
;
i
<
16
;
i
++
)
{
...
@@ -124,7 +125,7 @@ describe('fileIOTestDir', function () {
...
@@ -124,7 +125,7 @@ describe('fileIOTestDir', function () {
* @tc.desc Function of API, uri dir too many layers.
* @tc.desc Function of API, uri dir too many layers.
*/
*/
it
(
'
fileio_test_dir_open_sync_005
'
,
0
,
async
function
()
{
it
(
'
fileio_test_dir_open_sync_005
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
dir
'
);
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_open_sync_005
'
);
fileio
.
mkdirSync
(
dpath
);
fileio
.
mkdirSync
(
dpath
);
try
{
try
{
for
(
let
i
=
0
;
i
<
1024
;
i
++
)
{
for
(
let
i
=
0
;
i
<
1024
;
i
++
)
{
...
@@ -152,6 +153,7 @@ describe('fileIOTestDir', function () {
...
@@ -152,6 +153,7 @@ describe('fileIOTestDir', function () {
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_open_sync_006 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_dir_open_sync_006 has failed for
'
+
e
);
expect
(
e
.
message
==
'
No such file or directory
'
).
assertTrue
();
}
}
});
});
...
@@ -164,14 +166,14 @@ describe('fileIOTestDir', function () {
...
@@ -164,14 +166,14 @@ describe('fileIOTestDir', function () {
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_read_sync_000
'
)
+
'
d
'
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_read_sync_000
'
)
+
'
d
'
let
fpath
=
dpath
+
'
/f0
'
let
fpath
=
dpath
+
'
/f0
'
try
{
try
{
expect
(
typeof
(
fileio
.
mkdirSync
(
dpath
))
==
'
undefined
'
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
fileio
.
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
()
==
null
).
assertTrue
();
dd
.
closeSync
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
rmdirSync
(
dpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_read_sync_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_dir_read_sync_000 has failed for
'
+
e
);
...
@@ -188,10 +190,10 @@ describe('fileIOTestDir', function () {
...
@@ -188,10 +190,10 @@ describe('fileIOTestDir', function () {
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_read_sync_001
'
)
+
'
d
'
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_read_sync_001
'
)
+
'
d
'
let
fpathArray
=
new
Array
(
dpath
+
'
/f1
'
,
dpath
+
'
/f2
'
,
dpath
+
'
/d3
'
);
let
fpathArray
=
new
Array
(
dpath
+
'
/f1
'
,
dpath
+
'
/f2
'
,
dpath
+
'
/d3
'
);
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
if
(
i
==
2
)
{
if
(
i
==
2
)
{
expect
(
fileio
.
mkdirSync
(
fpathArray
[
i
])
!==
null
).
assertTrue
();
fileio
.
mkdirSync
(
fpathArray
[
i
])
}
else
{
}
else
{
expect
(
prepareFile
(
fpathArray
[
i
],
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpathArray
[
i
],
FILE_CONTENT
)).
assertTrue
();
}
}
...
@@ -199,23 +201,19 @@ describe('fileIOTestDir', function () {
...
@@ -199,23 +201,19 @@ describe('fileIOTestDir', function () {
let
dd
=
fileio
.
opendirSync
(
dpath
);
let
dd
=
fileio
.
opendirSync
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
expect
(
dd
!==
null
).
assertTrue
();
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
if
(
i
==
2
)
{
let
bool
=
typeof
(
dd
.
readSync
());
let
bool
=
typeof
(
dd
.
readSync
());
expect
(
bool
==
'
object
'
).
assertTrue
();
expect
(
bool
==
'
object
'
).
assertTrue
();
console
.
log
(
'
---bool=
'
+
bool
);
console
.
log
(
'
---bool=
'
+
bool
);
}
else
{
expect
(
dd
.
readSync
()
!==
null
).
assertTrue
();
}
}
}
expect
(
dd
.
closeSync
()
==
null
).
assertTrue
();
dd
.
closeSync
();
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
if
(
i
==
2
)
{
if
(
i
==
2
)
{
expect
(
fileio
.
rmdirSync
(
fpathArray
[
i
])
!==
null
).
assertTrue
(
);
fileio
.
rmdirSync
(
fpathArray
[
i
]
);
}
else
{
}
else
{
expect
(
fileio
.
unlinkSync
(
fpathArray
[
i
])
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpathArray
[
i
]
);
}
}
}
}
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
rmdirSync
(
dpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_read_sync_001 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_dir_read_sync_001 has failed for
'
+
e
);
...
@@ -232,10 +230,10 @@ describe('fileIOTestDir', function () {
...
@@ -232,10 +230,10 @@ describe('fileIOTestDir', function () {
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_read_sync_002
'
)
+
'
d
'
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_read_sync_002
'
)
+
'
d
'
let
fpathArray
=
new
Array
(
dpath
+
'
/f1
'
,
dpath
+
'
/f2
'
,
dpath
+
'
/d3
'
);
let
fpathArray
=
new
Array
(
dpath
+
'
/f1
'
,
dpath
+
'
/f2
'
,
dpath
+
'
/d3
'
);
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
();
fileio
.
mkdirSync
(
dpath
)
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
if
(
i
==
2
)
{
if
(
i
==
2
)
{
expect
(
fileio
.
mkdirSync
(
fpathArray
[
i
])
!==
null
).
assertTrue
();
fileio
.
mkdirSync
(
fpathArray
[
i
])
}
else
{
}
else
{
expect
(
prepareFile
(
fpathArray
[
i
],
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpathArray
[
i
],
FILE_CONTENT
)).
assertTrue
();
}
}
...
@@ -245,21 +243,21 @@ describe('fileIOTestDir', function () {
...
@@ -245,21 +243,21 @@ describe('fileIOTestDir', function () {
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
expect
(
dd
.
readSync
()
!==
null
).
assertTrue
();
expect
(
dd
.
readSync
()
!==
null
).
assertTrue
();
}
}
expect
(
dd
.
readSync
()
==
null
).
assertTrue
();
expect
(
dd
.
readSync
()
!==
null
).
assertTrue
();
expect
(
null
).
assertFail
();
dd
.
closeSync
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_read_sync_002 has failed for
'
+
e
);
expect
(
dd
.
closeSync
()
==
null
).
assertTrue
();
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
if
(
i
==
2
)
{
if
(
i
==
2
)
{
expect
(
fileio
.
rmdirSync
(
fpathArray
[
i
])
!==
null
).
assertTrue
(
);
fileio
.
rmdirSync
(
fpathArray
[
i
]
);
}
else
{
}
else
{
expect
(
fileio
.
unlinkSync
(
fpathArray
[
i
])
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpathArray
[
i
]
);
}
}
}
}
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
();
fileio
.
rmdirSync
(
dpath
);
}
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_read_sync_002 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
});
/**
/**
...
@@ -271,16 +269,16 @@ describe('fileIOTestDir', function () {
...
@@ -271,16 +269,16 @@ describe('fileIOTestDir', function () {
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_read_sync_003
'
)
+
'
d
'
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_read_sync_003
'
)
+
'
d
'
let
dd
;
let
dd
;
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
dd
=
fileio
.
opendirSync
(
dpath
);
dd
=
fileio
.
opendirSync
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
expect
(
dd
!==
null
).
assertTrue
();
expect
(
dd
.
readSync
()
==
null
).
assertTrue
();
expect
(
dd
.
readSync
()
!==
null
).
assertTrue
();
expect
(
null
).
assertFail
();
dd
.
closeSync
();
}
fileio
.
rmdirSync
(
dpath
);
}
catch
(
e
)
{
catch
(
e
)
{
expect
(
dd
.
closeSync
()
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
();
console
.
log
(
'
fileio_test_dir_read_sync_003 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_dir_read_sync_003 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
}
});
});
...
@@ -294,7 +292,7 @@ describe('fileIOTestDir', function () {
...
@@ -294,7 +292,7 @@ describe('fileIOTestDir', function () {
let
fpath
=
dpath
+
'
/f1
'
let
fpath
=
dpath
+
'
/f1
'
let
dd
let
dd
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
dd
=
fileio
.
opendirSync
(
dpath
);
dd
=
fileio
.
opendirSync
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
expect
(
dd
!==
null
).
assertTrue
();
...
@@ -302,10 +300,11 @@ describe('fileIOTestDir', function () {
...
@@ -302,10 +300,11 @@ describe('fileIOTestDir', function () {
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
catch
(
e
)
{
catch
(
e
)
{
expect
(
dd
.
closeSync
()
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
();
console
.
log
(
'
fileio_test_dir_read_sync_004 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_dir_read_sync_004 has failed for
'
+
e
);
expect
(
e
.
message
==
'
Number of arguments unmatched
'
).
assertTrue
();
dd
.
closeSync
();
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
}
}
});
});
...
@@ -318,18 +317,18 @@ describe('fileIOTestDir', function () {
...
@@ -318,18 +317,18 @@ describe('fileIOTestDir', function () {
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_read_sync_005
'
)
+
'
d
'
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_read_sync_005
'
)
+
'
d
'
let
fpath
=
dpath
+
'
/f
'
let
fpath
=
dpath
+
'
/f
'
try
{
try
{
expect
(
typeof
(
fileio
.
mkdirSync
(
dpath
))
==
'
undefined
'
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
for
(
let
i
=
0
;
i
<
10001
;
i
++
)
{
for
(
let
i
=
0
;
i
<
10001
;
i
++
)
{
expect
(
prepareFile
(
fpath
+
i
,
'
test_text
'
)).
assertTrue
();
expect
(
prepareFile
(
fpath
+
i
,
'
test_text
'
)).
assertTrue
();
}
}
let
dd
=
fileio
.
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
()
==
null
).
assertTrue
();
dd
.
closeSync
();
for
(
let
i
=
0
;
i
<
10001
;
i
++
)
{
for
(
let
i
=
0
;
i
<
10001
;
i
++
)
{
fileio
.
unlinkSync
(
fpath
+
i
);
fileio
.
unlinkSync
(
fpath
+
i
);
}
}
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
rmdirSync
(
dpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_read_sync_005 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_dir_read_sync_005 has failed for
'
+
e
);
...
@@ -345,15 +344,36 @@ describe('fileIOTestDir', function () {
...
@@ -345,15 +344,36 @@ describe('fileIOTestDir', function () {
it
(
'
fileio_test_dir_close_sync_000
'
,
0
,
async
function
()
{
it
(
'
fileio_test_dir_close_sync_000
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_close_sync_000
'
)
+
'
d
'
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_close_sync_000
'
)
+
'
d
'
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
let
dd
=
fileio
.
opendirSync
(
dpath
);
let
dd
=
fileio
.
opendirSync
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
expect
(
dd
!==
null
).
assertTrue
();
expect
(
dd
.
closeSync
()
==
null
).
assertTrue
();
dd
.
closeSync
();
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
rmdirSync
(
dpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_close_sync_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_dir_close_sync_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
});
});
/**
* @tc.number SUB_STORAGE_FileIO_dir_CloseSync_0100
* @tc.name fileio_test_dir_close_sync_001
* @tc.desc Function of API, closeSync. error parameter.
*/
it
(
'
fileio_test_dir_close_sync_001
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_close_sync_001
'
)
+
'
d
'
try
{
fileio
.
mkdirSync
(
dpath
);
let
dd
=
fileio
.
opendirSync
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
dd
.
closeSync
(
-
1
);
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_close_sync_001 has failed for
'
+
e
);
expect
(
e
.
message
==
'
Dir has been closed yet
'
).
assertTrue
();
fileio
.
rmdirSync
(
dpath
);
}
});
});
});
storage/storagefileiojstest/src/main/js/default/test/FileIOStat.test.js
浏览文件 @
905cff78
...
@@ -41,7 +41,7 @@ describe('fileIOTestStat', function () {
...
@@ -41,7 +41,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
stat
!==
null
).
assertTrue
();
expect
(
stat
!==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_stat_sync_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_stat_sync_000 has failed for
'
+
e
);
...
@@ -62,6 +62,7 @@ describe('fileIOTestStat', function () {
...
@@ -62,6 +62,7 @@ describe('fileIOTestStat', function () {
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_stat_sync_001 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_stat_sync_001 has failed for
'
+
e
);
expect
(
e
.
message
==
'
No such file or directory
'
).
assertTrue
();
}
}
});
});
...
@@ -72,11 +73,11 @@ describe('fileIOTestStat', function () {
...
@@ -72,11 +73,11 @@ describe('fileIOTestStat', function () {
*/
*/
it
(
'
fileio_test_stat_stat_sync_002
'
,
0
,
async
function
()
{
it
(
'
fileio_test_stat_stat_sync_002
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileio_test_stat_stat_sync_002
'
)
+
'
d
'
;
let
dpath
=
await
nextFileName
(
'
fileio_test_stat_stat_sync_002
'
)
+
'
d
'
;
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
try
{
try
{
let
stat
=
fileio
.
statSync
(
dpath
);
let
stat
=
fileio
.
statSync
(
dpath
);
expect
(
stat
!==
null
).
assertTrue
();
expect
(
stat
!==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
rmdirSync
(
dpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_stat_sync_002 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_stat_sync_002 has failed for
'
+
e
);
...
@@ -118,7 +119,7 @@ describe('fileIOTestStat', function () {
...
@@ -118,7 +119,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
dev
)
==
'
number
'
).
assertTrue
();
expect
(
typeof
(
stat
.
dev
)
==
'
number
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_dev_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_dev_000 has failed for
'
+
e
);
...
@@ -137,7 +138,7 @@ describe('fileIOTestStat', function () {
...
@@ -137,7 +138,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
ino
)
==
'
number
'
).
assertTrue
();
expect
(
typeof
(
stat
.
ino
)
==
'
number
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_ino_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_ino_000 has failed for
'
+
e
);
...
@@ -156,7 +157,7 @@ describe('fileIOTestStat', function () {
...
@@ -156,7 +157,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
mode
)
==
'
number
'
).
assertTrue
();
expect
(
typeof
(
stat
.
mode
)
==
'
number
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_mode_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_mode_000 has failed for
'
+
e
);
...
@@ -175,7 +176,7 @@ describe('fileIOTestStat', function () {
...
@@ -175,7 +176,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
nlink
)
==
'
number
'
).
assertTrue
();
expect
(
typeof
(
stat
.
nlink
)
==
'
number
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_nlink_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_nlink_000 has failed for
'
+
e
);
...
@@ -194,7 +195,7 @@ describe('fileIOTestStat', function () {
...
@@ -194,7 +195,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
uid
)
==
'
number
'
).
assertTrue
();
expect
(
typeof
(
stat
.
uid
)
==
'
number
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_uid_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_uid_000 has failed for
'
+
e
);
...
@@ -213,7 +214,7 @@ describe('fileIOTestStat', function () {
...
@@ -213,7 +214,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
gid
)
==
'
number
'
).
assertTrue
();
expect
(
typeof
(
stat
.
gid
)
==
'
number
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_gid_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_gid_000 has failed for
'
+
e
);
...
@@ -232,7 +233,7 @@ describe('fileIOTestStat', function () {
...
@@ -232,7 +233,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
rdev
)
==
'
number
'
).
assertTrue
();
expect
(
typeof
(
stat
.
rdev
)
==
'
number
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_rdev_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_rdev_000 has failed for
'
+
e
);
...
@@ -251,7 +252,7 @@ describe('fileIOTestStat', function () {
...
@@ -251,7 +252,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
size
)
==
'
number
'
).
assertTrue
();
expect
(
typeof
(
stat
.
size
)
==
'
number
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_size_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_size_000 has failed for
'
+
e
);
...
@@ -259,25 +260,6 @@ describe('fileIOTestStat', function () {
...
@@ -259,25 +260,6 @@ describe('fileIOTestStat', function () {
}
}
});
});
/**
* @tc.number SUB_STORAGE_FileIO_Stat_blksize_0000
* @tc.name fileio_test_stat_blksize_000
* @tc.desc Function of API. Gets the size of the disk block containing the file.
*/
it
(
'
fileio_test_stat_blksize_000
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileio_test_stat_blksize_000
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
blksize
)
==
'
number
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_blksize_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
/**
* @tc.number SUB_STORAGE_FileIO_Stat_blocks_0000
* @tc.number SUB_STORAGE_FileIO_Stat_blocks_0000
* @tc.name fileio_test_stat_blocks_000
* @tc.name fileio_test_stat_blocks_000
...
@@ -289,7 +271,7 @@ describe('fileIOTestStat', function () {
...
@@ -289,7 +271,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
blocks
)
==
'
number
'
).
assertTrue
();
expect
(
typeof
(
stat
.
blocks
)
==
'
number
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_blocks_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_blocks_000 has failed for
'
+
e
);
...
@@ -308,7 +290,7 @@ describe('fileIOTestStat', function () {
...
@@ -308,7 +290,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
atime
)
==
'
number
'
).
assertTrue
();
expect
(
typeof
(
stat
.
atime
)
==
'
number
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_atime_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_atime_000 has failed for
'
+
e
);
...
@@ -327,7 +309,7 @@ describe('fileIOTestStat', function () {
...
@@ -327,7 +309,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
mtime
)
==
'
number
'
).
assertTrue
();
expect
(
typeof
(
stat
.
mtime
)
==
'
number
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_mtime_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_mtime_000 has failed for
'
+
e
);
...
@@ -346,7 +328,7 @@ describe('fileIOTestStat', function () {
...
@@ -346,7 +328,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
ctime
)
==
'
number
'
).
assertTrue
();
expect
(
typeof
(
stat
.
ctime
)
==
'
number
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_ctime_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_ctime_000 has failed for
'
+
e
);
...
@@ -365,7 +347,7 @@ describe('fileIOTestStat', function () {
...
@@ -365,7 +347,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
isBlockDevice
())
==
'
boolean
'
).
assertTrue
();
expect
(
typeof
(
stat
.
isBlockDevice
())
==
'
boolean
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_block_device_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_block_device_000 has failed for
'
+
e
);
...
@@ -384,7 +366,7 @@ describe('fileIOTestStat', function () {
...
@@ -384,7 +366,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
!
stat
.
isBlockDevice
()).
assertTrue
();
expect
(
!
stat
.
isBlockDevice
()).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_block_device_001 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_block_device_001 has failed for
'
+
e
);
...
@@ -406,8 +388,9 @@ describe('fileIOTestStat', function () {
...
@@ -406,8 +388,9 @@ describe('fileIOTestStat', function () {
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
catch
(
e
)
{
catch
(
e
)
{
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
();
console
.
log
(
'
fileio_test_stat_is_block_device_002 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_block_device_002 has failed for
'
+
e
);
expect
(
e
.
message
==
'
Number of arguments unmatched
'
).
assertTrue
();
fileio
.
unlinkSync
(
fpath
);
}
}
});
});
...
@@ -422,7 +405,7 @@ describe('fileIOTestStat', function () {
...
@@ -422,7 +405,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
isCharacterDevice
())
==
'
boolean
'
).
assertTrue
();
expect
(
typeof
(
stat
.
isCharacterDevice
())
==
'
boolean
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_character_device_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_character_device_000 has failed for
'
+
e
);
...
@@ -441,7 +424,7 @@ describe('fileIOTestStat', function () {
...
@@ -441,7 +424,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
!
stat
.
isCharacterDevice
()).
assertTrue
();
expect
(
!
stat
.
isCharacterDevice
()).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_character_device_001 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_character_device_001 has failed for
'
+
e
);
...
@@ -464,7 +447,8 @@ describe('fileIOTestStat', function () {
...
@@ -464,7 +447,8 @@ describe('fileIOTestStat', function () {
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_character_device_002 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_character_device_002 has failed for
'
+
e
);
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
();
expect
(
e
.
message
==
'
Number of arguments unmatched
'
).
assertTrue
();
fileio
.
unlinkSync
(
fpath
);
}
}
});
});
...
@@ -479,7 +463,7 @@ describe('fileIOTestStat', function () {
...
@@ -479,7 +463,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
isDirectory
())
==
'
boolean
'
).
assertTrue
();
expect
(
typeof
(
stat
.
isDirectory
())
==
'
boolean
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_directory_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_directory_000 has failed for
'
+
e
);
...
@@ -498,7 +482,7 @@ describe('fileIOTestStat', function () {
...
@@ -498,7 +482,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
!
stat
.
isDirectory
()).
assertTrue
();
expect
(
!
stat
.
isDirectory
()).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_directory_001 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_directory_001 has failed for
'
+
e
);
...
@@ -514,10 +498,10 @@ describe('fileIOTestStat', function () {
...
@@ -514,10 +498,10 @@ describe('fileIOTestStat', function () {
it
(
'
fileio_test_stat_is_directory_002
'
,
0
,
async
function
()
{
it
(
'
fileio_test_stat_is_directory_002
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileio_test_stat_is_directory_002
'
)
+
'
d
'
let
dpath
=
await
nextFileName
(
'
fileio_test_stat_is_directory_002
'
)
+
'
d
'
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
let
stat
=
fileio
.
statSync
(
dpath
);
let
stat
=
fileio
.
statSync
(
dpath
);
expect
(
stat
.
isDirectory
()).
assertTrue
();
expect
(
stat
.
isDirectory
()).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
rmdirSync
(
dpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_directory_002 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_directory_002 has failed for
'
+
e
);
...
@@ -533,14 +517,15 @@ describe('fileIOTestStat', function () {
...
@@ -533,14 +517,15 @@ describe('fileIOTestStat', function () {
it
(
'
fileio_test_stat_is_directory_003
'
,
0
,
async
function
()
{
it
(
'
fileio_test_stat_is_directory_003
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileio_test_stat_is_directory_003
'
)
+
'
d
'
let
dpath
=
await
nextFileName
(
'
fileio_test_stat_is_directory_003
'
)
+
'
d
'
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
let
stat
=
fileio
.
statSync
(
dpath
);
let
stat
=
fileio
.
statSync
(
dpath
);
expect
(
stat
.
isDirectory
(
-
1
)
==
null
).
assertTrue
();
expect
(
stat
.
isDirectory
(
-
1
)
==
null
).
assertTrue
();
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_directory_003 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_directory_003 has failed for
'
+
e
);
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
();
expect
(
e
.
message
==
'
Number of arguments unmatched
'
).
assertTrue
();
fileio
.
rmdirSync
(
dpath
);
}
}
});
});
...
@@ -555,7 +540,7 @@ describe('fileIOTestStat', function () {
...
@@ -555,7 +540,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
isFIFO
())
==
'
boolean
'
).
assertTrue
();
expect
(
typeof
(
stat
.
isFIFO
())
==
'
boolean
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_fifo_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_fifo_000 has failed for
'
+
e
);
...
@@ -574,7 +559,7 @@ describe('fileIOTestStat', function () {
...
@@ -574,7 +559,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
!
stat
.
isFIFO
()).
assertTrue
();
expect
(
!
stat
.
isFIFO
()).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_fifo_001 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_fifo_001 has failed for
'
+
e
);
...
@@ -597,7 +582,8 @@ describe('fileIOTestStat', function () {
...
@@ -597,7 +582,8 @@ describe('fileIOTestStat', function () {
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_fifo_002 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_fifo_002 has failed for
'
+
e
);
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
();
expect
(
e
.
message
==
'
Number of arguments unmatched
'
).
assertTrue
();
fileio
.
unlinkSync
(
fpath
);
}
}
});
});
...
@@ -612,7 +598,7 @@ describe('fileIOTestStat', function () {
...
@@ -612,7 +598,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
isFile
())
==
'
boolean
'
).
assertTrue
();
expect
(
typeof
(
stat
.
isFile
())
==
'
boolean
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_file_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_file_000 has failed for
'
+
e
);
...
@@ -631,7 +617,7 @@ describe('fileIOTestStat', function () {
...
@@ -631,7 +617,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
stat
.
isFile
()).
assertTrue
();
expect
(
stat
.
isFile
()).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
console
.
log
(
'
---fileio_test_stat_is_file_001 is passed!
'
);
console
.
log
(
'
---fileio_test_stat_is_file_001 is passed!
'
);
}
}
catch
(
e
)
{
catch
(
e
)
{
...
@@ -648,10 +634,10 @@ describe('fileIOTestStat', function () {
...
@@ -648,10 +634,10 @@ describe('fileIOTestStat', function () {
it
(
'
fileio_test_stat_is_file_002
'
,
0
,
async
function
()
{
it
(
'
fileio_test_stat_is_file_002
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileio_test_stat_is_file_002
'
);
let
dpath
=
await
nextFileName
(
'
fileio_test_stat_is_file_002
'
);
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
let
stat
=
fileio
.
statSync
(
dpath
);
let
stat
=
fileio
.
statSync
(
dpath
);
expect
(
!
stat
.
isFile
()).
assertTrue
();
expect
(
!
stat
.
isFile
()).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
rmdirSync
(
dpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_file_002 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_file_002 has failed for
'
+
e
);
...
@@ -667,14 +653,15 @@ describe('fileIOTestStat', function () {
...
@@ -667,14 +653,15 @@ describe('fileIOTestStat', function () {
it
(
'
fileio_test_stat_is_file_003
'
,
0
,
async
function
()
{
it
(
'
fileio_test_stat_is_file_003
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileio_test_stat_is_file_003
'
);
let
dpath
=
await
nextFileName
(
'
fileio_test_stat_is_file_003
'
);
try
{
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
let
stat
=
fileio
.
statSync
(
dpath
);
let
stat
=
fileio
.
statSync
(
dpath
);
expect
(
stat
.
isFile
(
-
1
)
==
null
).
assertTrue
();
expect
(
stat
.
isFile
(
-
1
)
==
null
).
assertTrue
();
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
catch
(
e
)
{
catch
(
e
)
{
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
();
console
.
log
(
'
fileio_test_stat_is_file_003 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_file_003 has failed for
'
+
e
);
expect
(
e
.
message
==
'
Number of arguments unmatched
'
).
assertTrue
();
fileio
.
rmdirSync
(
dpath
);
}
}
});
});
...
@@ -689,7 +676,7 @@ describe('fileIOTestStat', function () {
...
@@ -689,7 +676,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
isSocket
())
==
'
boolean
'
).
assertTrue
();
expect
(
typeof
(
stat
.
isSocket
())
==
'
boolean
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_socket_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_socket_000 has failed for
'
+
e
);
...
@@ -708,7 +695,7 @@ describe('fileIOTestStat', function () {
...
@@ -708,7 +695,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
!
stat
.
isSocket
()).
assertTrue
();
expect
(
!
stat
.
isSocket
()).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_socket_001 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_socket_001 has failed for
'
+
e
);
...
@@ -731,7 +718,8 @@ describe('fileIOTestStat', function () {
...
@@ -731,7 +718,8 @@ describe('fileIOTestStat', function () {
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_socket_002 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_socket_002 has failed for
'
+
e
);
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
();
expect
(
e
.
message
==
'
Number of arguments unmatched
'
).
assertTrue
();
fileio
.
unlinkSync
(
fpath
);
}
}
});
});
...
@@ -746,7 +734,7 @@ describe('fileIOTestStat', function () {
...
@@ -746,7 +734,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
typeof
(
stat
.
isSymbolicLink
())
==
'
boolean
'
).
assertTrue
();
expect
(
typeof
(
stat
.
isSymbolicLink
())
==
'
boolean
'
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_symbolic_link_000 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_symbolic_link_000 has failed for
'
+
e
);
...
@@ -765,7 +753,7 @@ describe('fileIOTestStat', function () {
...
@@ -765,7 +753,7 @@ describe('fileIOTestStat', function () {
try
{
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
!
stat
.
isSymbolicLink
()).
assertTrue
();
expect
(
!
stat
.
isSymbolicLink
()).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_symbolic_link_001 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_symbolic_link_001 has failed for
'
+
e
);
...
@@ -788,7 +776,8 @@ describe('fileIOTestStat', function () {
...
@@ -788,7 +776,8 @@ describe('fileIOTestStat', function () {
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_stat_is_symbolic_link_002 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_stat_is_symbolic_link_002 has failed for
'
+
e
);
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
();
expect
(
e
.
message
==
'
Number of arguments unmatched
'
).
assertTrue
();
fileio
.
unlinkSync
(
fpath
);
}
}
});
});
...
...
storage/storagefileiojstest/src/main/js/default/test/FileIOStream.test.js
浏览文件 @
905cff78
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录