Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8c29313a
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看板
未验证
提交
8c29313a
编写于
6月 22, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3571 刪除fileio重复用例以及冗余代码、注释规范修改
Merge pull request !3571 from zhangxingxia/OpenHarmony-3.1-Release
上级
d60c9f66
44444245
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
328 addition
and
710 deletion
+328
-710
storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dir/close.test.js
...ain/js/default/test/module_fileio/class_dir/close.test.js
+40
-19
storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dir/read.test.js
...main/js/default/test/module_fileio/class_dir/read.test.js
+236
-666
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/close.test.js
.../main/js/default/test/module_fileio/members/close.test.js
+52
-25
未找到文件。
storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dir/close.test.js
浏览文件 @
8c29313a
...
...
@@ -15,24 +15,19 @@
import
{
fileio
,
FILE_CONTENT
,
prepareFile
,
nextFileName
,
isIntNum
,
isString
,
isBoolean
,
describe
,
it
,
expect
,
}
from
'
../../Common
'
;
describe
(
'
fileio_dir_close
_read
'
,
function
()
{
describe
(
'
fileio_dir_close
'
,
function
()
{
/**
* @tc.number SUB_DF_FILEIO_DIR_CLOSE_ASYNC_0000
* @tc.name fileio_test_dir_close_async_000
* @tc.desc Test Dir
.closeAsync() interfac
e.
* @tc.size MEDIUM
(中型)
* @tc.desc Test Dir
close() interface,return in promise mod
e.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
...
...
@@ -41,37 +36,63 @@ describe('fileio_dir_close_read', function () {
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_close_async_000
'
)
+
'
d
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
expect
((
await
dd
.
close
())
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
await
dd
.
close
();
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_close_async_000 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_close_async_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_close_Async_0
001
* @tc.number SUB_DF_FileIO_Dir_close_Async_0
100
* @tc.name fileio_test_dir_close_async_001
* @tc.desc Test Dir.closeAsync() interface.
* @tc.desc Test Dir close() interface,return in callback mode.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_dir_close_async_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_close_async_001
'
)
+
'
d
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
dd
.
close
(
function
(
err
)
{
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
rmdirSync
(
dpath
);
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_close_async_001 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_close_async_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_close_Async_0200
* @tc.name fileio_test_dir_close_async_002
* @tc.desc Test Dir close() interface,there are multiple parameters.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_dir_close_async_002
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_close_async_002
'
)
+
'
d
'
;
try
{
fileio
.
mkdirSync
(
dpath
);
let
dd
=
await
fileio
.
opendir
(
dpath
);
dd
.
close
(
-
1
,
function
(
err
)
{
});
}
catch
(
e
)
{
console
.
info
(
'
fileio_test_dir_close_async_002 has failed for
'
+
e
);
expect
(
e
.
message
==
"
Number of arguments unmatched
"
).
assertTrue
();
fileio
.
rmdirSync
(
dpath
);
done
();
}
});
});
storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dir/read.test.js
浏览文件 @
8c29313a
...
...
@@ -14,1028 +14,598 @@
*/
import
{
fileio
,
FILE_CONTENT
,
prepareFile
,
nextFileName
,
is
IntNum
,
is
String
,
isBoolean
,
fileio
,
FILE_CONTENT
,
prepareFile
,
nextFileName
,
isString
,
isBoolean
,
describe
,
it
,
expect
,
}
from
'
../../Common
'
;
describe
(
'
fileio_dir_read
'
,
function
()
{
/**
* @tc.number SUB_DF_F
ileIO_ReadSync
_0000
* @tc.name fileio_test_dir_read_
file_
sync_000
* @tc.desc Test Dir
.readSync() interfac
e.
* @tc.size MEDIUM
(中型)
* @tc.number SUB_DF_F
ILEIO_DIR_READ_ASYNC
_0000
* @tc.name fileio_test_dir_read_
a
sync_000
* @tc.desc Test Dir
read() interface,return in promise mod
e.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_dir_read_file_sync_000
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileio_test_dir_read_file_sync_000
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
stat
=
fileio
.
statSync
(
fpath
);
expect
(
isIntNum
(
stat
.
size
)).
assertTrue
();
let
fd
=
fileio
.
openSync
(
fpath
,
0o2
);
expect
(
isIntNum
(
fd
)).
assertTrue
();
let
len
=
fileio
.
readSync
(
fd
,
new
ArrayBuffer
(
stat
.
size
));
expect
(
len
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fileio
.
closeSync
(
fd
)
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_read_file_sync_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_open_close_ASync_0000
* @tc.name fileio_test_dir_open_close_async_000
* @tc.desc Test Dir.readSync() interface.
*/
it
(
'
fileio_test_dir_open_close_async_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_open_close_async_000
'
)
+
'
d
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
expect
(
dd
.
closeSync
()
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_open_close_async_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_open_close_ASync_0010
* @tc.name fileio_test_dir_open_close_async_001
* @tc.desc Test Dir.readSync() interface.
*/
it
(
'
fileio_test_dir_open_close_async_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_open_close_async_001
'
)
+
'
d
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
fileio
.
opendir
(
dpath
,
function
(
error
,
dd
)
{
expect
(
dd
!==
null
).
assertTrue
();
expect
(
dd
.
closeSync
()
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_open_close_async_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_open_close_ASync_0000
* @tc.name fileio_test_dir_open_close_async_000
* @tc.desc Test Dir.readSync() interface.
*/
it
(
'
fileio_test_dir_read_async_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_read_async_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
fileio
.
opendirSync
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
expect
(
await
dd
.
read
()
!=
null
).
assertTrue
();
expect
(
dd
.
closeSync
()
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
dd
.
closeSync
();
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_read_async_000 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_read_async_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_open_close_ASync_0010
* @tc.name fileio_test_dir_open_close_async_001
* @tc.desc Test Dir.readSync() interface.
* @tc.number SUB_DF_FILEIO_DIR_READ_ASYNC_0100
* @tc.name fileio_test_dir_read_async_001
* @tc.desc Test Dir read() interface,return in callback mode.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_dir_read_async_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_read_async_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
fileio
.
opendirSync
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
dd
.
read
(
function
(
err
,
dirent
)
{
expect
(
dd
.
closeSync
()
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
dd
.
closeSync
();
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_dir_read_async_001 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_dir_read_async_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadSync_0000
* @tc.number SUB_DF_FILEIO_DIR_READ_ASYNC_0200
* @tc.name fileio_test_dir_read_async_002
* @tc.desc Test Dir read() interface,there are multiple parameters.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_dir_read_async_002
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_test_dir_read_async_002
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
let
dd
=
null
try
{
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
dd
=
fileio
.
opendirSync
(
dpath
);
dd
.
read
(
-
1
,
function
(
err
,
dirent
)
{
});
}
catch
(
e
)
{
console
.
info
(
'
fileio_test_dir_read_async_002 has failed for
'
+
e
);
expect
(
e
.
message
==
"
Number of arguments unmatched
"
).
assertTrue
();
dd
.
closeSync
();
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
});
/**
* @tc.number SUB_DF_FILEIO_DIR_READ_SYNC_0000
* @tc.name fileio_dir_read_sync_000
* @tc.desc Test Dir.readSync() interface.
* @tc.desc Test Dir readSync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_sync_000
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
fileio
.
opendirSync
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
expect
(
dd
.
readSync
()
!=
null
).
assertTrue
();
expect
(
dd
.
closeSync
()
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
dd
.
readSync
();
dd
.
closeSync
();
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_000 has failed for
'
+
e
);
console
.
info
(
'
fileio_dir_read_sync_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadSync_001
0
* @tc.number SUB_DF_F
ILEIO_DIR_READ_SYNC_010
0
* @tc.name fileio_dir_read_sync_001
* @tc.desc Test Dir.readSync() interface.
* @tc.desc Test Dir.readSync() interface,there are multiple parameters.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_sync_001
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
let
dd
;
let
dd
=
null
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
dd
=
fileio
.
opendirSync
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
expect
(
dd
.
readSync
(
-
1
)
!=
null
).
assertTrue
();
expect
(
null
).
assertFail
();
dd
.
readSync
(
-
1
);
}
catch
(
e
)
{
expect
(
dd
.
closeSync
()
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
console
.
info
(
'
fileio_dir_read_sync_001 has failed for
'
+
e
);
expect
(
e
.
message
==
"
Number of arguments unmatched
"
).
assertTrue
();
dd
.
closeSync
();
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadSync_Name
_0000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_SYNC_NAME
_0000
* @tc.name fileio_dir_read_sync_name_000
* @tc.desc Test Dir.readSync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_sync_name_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_name_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
isString
(
dir
.
name
)).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_name_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadSync_Name_0010
* @tc.name fileio_dir_read_sync_name_001
* @tc.desc Test Dir.readSync() interface.
*/
it
(
'
fileio_dir_read_sync_name_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_name_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
fpath
.
indexOf
(
dir
.
name
)
>
-
1
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_name_001
has failed for
'
+
e
);
console
.
info
(
'
fileio_dir_read_sync_name_000
has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadSync_isBlockDevice
_0000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_SYNC_ISBLOCKDEVICE
_0000
* @tc.name fileio_dir_read_sync_isBlockDevice_000
* @tc.desc Test Dir.readSync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_sync_isBlockDevice_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_isBlockDevice_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
isBoolean
(
dir
.
isBlockDevice
())).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_isBlockDevice_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadSync_isBlockDevice_0010
* @tc.name fileio_dir_read_sync_isBlockDevice_001
* @tc.desc Test Dir.readSync() interface.
*/
it
(
'
fileio_dir_read_sync_isBlockDevice_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_isBlockDevice_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
dir
.
isBlockDevice
()
===
false
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_isBlockDevice_001
has failed for
'
+
e
);
console
.
info
(
'
fileio_dir_read_sync_isBlockDevice_000
has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadSync_isCharacterDevice
_0000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_SYNC_ISCHARACTERDEVICE
_0000
* @tc.name fileio_dir_read_sync_isCharacterDevice_000
* @tc.desc Test Dir.readSync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_sync_isCharacterDevice_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_isCharacterDevice_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
isBoolean
(
dir
.
isCharacterDevice
())).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_isCharacterDevice_000 has failed for
'
+
e
);
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadSync_isCharacterDevice_0010
* @tc.name fileio_dir_read_sync_isCharacterDevice_001
* @tc.desc Test Dir.readSync() interface.
*/
it
(
'
fileio_dir_read_sync_isCharacterDevice_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_isCharacterDevice_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
dir
.
isCharacterDevice
()
===
false
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_isCharacterDevice_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
console
.
info
(
'
fileio_dir_read_sync_isCharacterDevice_000 has failed for
'
+
e
);
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadSync_isDirectory
_0000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_SYNC_ISDIRECTORY
_0000
* @tc.name fileio_dir_read_sync_isDirectory_000
* @tc.desc Test Dir.readSync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_sync_isDirectory_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_isDirectory_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
isBoolean
(
dir
.
isDirectory
())).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_isDirectory_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadSync_isDirectory_0010
* @tc.name fileio_dir_read_sync_isDirectory_001
* @tc.desc Test Dir.readSync() interface.
*/
it
(
'
fileio_dir_read_sync_isDirectory_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_isDirectory_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
dir
.
isDirectory
()
===
false
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_isDirectory_001
has failed for
'
+
e
);
console
.
info
(
'
fileio_dir_read_sync_isDirectory_000
has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadSync_is
FIFO_0000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_SYNC_IS
FIFO_0000
* @tc.name fileio_dir_read_sync_isFIFO_000
* @tc.desc Test Dir.readSync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_sync_isFIFO_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_isFIFO_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
isBoolean
(
dir
.
isFIFO
())).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_isFIFO_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadSync_isFIFO_0010
* @tc.name fileio_dir_read_sync_isFIFO_001
* @tc.desc Test Dir.readSync() interface.
*/
it
(
'
fileio_dir_read_sync_isFIFO_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_isFIFO_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
dir
.
isFIFO
()
===
false
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_isFIFO_001
has failed for
'
+
e
);
console
.
info
(
'
fileio_dir_read_sync_isFIFO_000
has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadSync_isFile
_0000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_SYNC_ISFILE
_0000
* @tc.name fileio_dir_read_sync_isFile_000
* @tc.desc Test Dir.readSync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_sync_isFile_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_isFile_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
isBoolean
(
dir
.
isFile
())).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_isFile_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadSync_isFile_0010
* @tc.name fileio_dir_read_sync_isFile_001
* @tc.desc Test Dir.readSync() interface.
*/
it
(
'
fileio_dir_read_sync_isFile_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_isFile_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
dir
.
isFile
()).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_isFile_001
has failed for
'
+
e
);
console
.
info
(
'
fileio_dir_read_sync_isFile_000
has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadSync_isSocket
_0000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_SYNC_ISCOCKET
_0000
* @tc.name fileio_dir_read_sync_isSocket_000
* @tc.desc Test Dir.readSync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_sync_isSocket_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_isSocket_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
isBoolean
(
dir
.
isSocket
())).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_isSocket_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadSync_isSocket_0010
* @tc.name fileio_dir_read_sync_isSocket_001
* @tc.desc Test Dir.readSync() interface.
*/
it
(
'
fileio_dir_read_sync_isSocket_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_isSocket_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
dir
.
isSocket
()
===
false
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_isSocket_001
has failed for
'
+
e
);
console
.
info
(
'
fileio_dir_read_sync_isSocket_000
has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadSync_isSymbolicLink
_0000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_SYNC_ISSYMBOLICLINK
_0000
* @tc.name fileio_dir_read_sync_isSymbolicLink_000
* @tc.desc Test Dir.readSync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_sync_isSymbolicLink_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_isSymbolicLink_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
isBoolean
(
dir
.
isSymbolicLink
())).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_isSymbolicLink_000 has failed for
'
+
e
);
expect
(
null
);
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadSync_isSymbolicLink_0010
* @tc.name fileio_dir_read_sync_isSymbolicLink_001
* @tc.desc Test Dir.readSync() interface.
*/
it
(
'
fileio_dir_read_sync_isSymbolicLink_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_sync_isSymbolicLink_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
dd
.
readSync
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
dir
.
isSymbolicLink
()
===
false
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_sync_isSymbolicLink_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadAsync_0000
* @tc.name fileio_dir_read_async_000
* @tc.desc Test Dir.readAsync() interface.
*/
it
(
'
fileio_dir_read_async_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
fileio
.
opendirSync
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
expect
(
await
dd
.
read
()
!=
null
).
assertTrue
();
expect
(
dd
.
closeSync
()
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadAsync_0010
* @tc.name fileio_dir_read_async_001
* @tc.desc Test Dir.readAsync() interface.
*/
it
(
'
fileio_dir_read_async_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
fileio
.
opendirSync
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
dd
.
read
(
function
(
err
,
dirent
)
{
expect
(
dd
.
closeSync
()
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
})
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_001
has failed for
'
+
e
);
expect
(
null
)
.
assertFail
()
;
console
.
info
(
'
fileio_dir_read_sync_isSymbolicLink_000
has failed for
'
+
e
);
expect
(
null
);
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadAsync_Name
_0000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_ASYNC_NAME
_0000
* @tc.name fileio_dir_read_async_name_000
* @tc.desc Test Dir.readAsync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_async_name_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_name_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
isString
(
dir
.
name
)).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_name_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadAsync_Name_0010
* @tc.name fileio_dir_read_async_name_001
* @tc.desc Test Dir.readAsync() interface.
*/
it
(
'
fileio_dir_read_async_name_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_name_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
fpath
.
indexOf
(
dir
.
name
)
>
-
1
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_name_001
has failed for
'
+
e
);
console
.
info
(
'
fileio_dir_read_async_name_000
has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadAsync_IsBlockDevice
_0000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_ASYNC_ISBLOCKDEVICE
_0000
* @tc.name fileio_dir_read_async_isBlockDevice_000
* @tc.desc Test Dir.readAsync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_async_isBlockDevice_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_isBlockDevice_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
isBoolean
(
dir
.
isBlockDevice
())).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_isBlockDevice_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadAsync_IsBlockDevice_0010
* @tc.name fileio_dir_read_async_isBlockDevice_001
* @tc.desc Test Dir.readAsync() interface.
*/
it
(
'
fileio_dir_read_async_isBlockDevice_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_isBlockDevice_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
dir
.
isBlockDevice
()
===
false
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_isBlockDevice_001
has failed for
'
+
e
);
console
.
info
(
'
fileio_dir_read_async_isBlockDevice_000
has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadAsync_IsCharacterDevice
_0000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_ASYNC_ISCHARACTERDEVICE
_0000
* @tc.name fileio_dir_read_async_isCharacterDevice_000
* @tc.desc Test Dir.readAsync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_async_isCharacterDevice_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_isCharacterDevice_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
isBoolean
(
dir
.
isCharacterDevice
())).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_isCharacterDevice_000 has failed for
'
+
e
);
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadAsync_IsCharacterDevice_0010
* @tc.name fileio_dir_read_async_isCharacterDevice_001
* @tc.desc Test Dir.readAsync() interface.
*/
it
(
'
fileio_dir_read_async_isCharacterDevice_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_isCharacterDevice_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
dir
.
isCharacterDevice
()
===
false
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_isCharacterDevice_001
has failed for
'
+
e
);
console
.
info
(
'
fileio_dir_read_async_isCharacterDevice_000
has failed for
'
+
e
);
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadAsync_IsDirectory
_0000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_ASYNC_ISDIRECTORY
_0000
* @tc.name fileio_dir_read_async_isDirectory_000
* @tc.desc Test Dir.readAsync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_async_isDirectory_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_isDirectory_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
isBoolean
(
dir
.
isDirectory
())).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_isDirectory_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadAsync_IsDirectory_0010
* @tc.name fileio_dir_read_async_isDirectory_001
* @tc.desc Test Dir.readAsync() interface.
*/
it
(
'
fileio_dir_read_async_isDirectory_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_isDirectory_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
dir
.
isDirectory
()
===
false
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_isDirectory_001
has failed for
'
+
e
);
console
.
info
(
'
fileio_dir_read_async_isDirectory_000
has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadAsync_Is
FIFO_0000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_ASYNC_IS
FIFO_0000
* @tc.name fileio_dir_read_async_isFIFO_000
* @tc.desc Test Dir.readAsync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_async_isFIFO_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_isFIFO_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
isBoolean
(
dir
.
isFIFO
())).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_isFIFO_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadAsync_IsFIFO_0010
* @tc.name fileio_dir_read_async_isFIFO_001
* @tc.desc Test Dir.readAsync() interface.
*/
it
(
'
fileio_dir_read_async_isFIFO_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_isFIFO_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
dir
.
isFIFO
()
===
false
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_isFIFO_001
has failed for
'
+
e
);
console
.
info
(
'
fileio_dir_read_async_isFIFO_000
has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadAsync_IsFile
_0000
* @tc.name fileio_dir_read_async_is
Directory
_000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_ASYNC_ISFILE
_0000
* @tc.name fileio_dir_read_async_is
File
_000
* @tc.desc Test Dir.readAsync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_async_is
Directory
_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_is
Directory
_000
'
)
+
'
d
'
;
it
(
'
fileio_dir_read_async_is
File
_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_is
File
_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
isBoolean
(
dir
.
isFile
())).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_isDirectory_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadAsync_IsFile_0010
* @tc.name fileio_dir_read_async_isDirectory_001
* @tc.desc Test Dir.readAsync() interface.
*/
it
(
'
fileio_dir_read_async_isDirectory_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_isDirectory_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
dir
.
isFile
()).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_isDirectory_001
has failed for
'
+
e
);
console
.
info
(
'
fileio_dir_read_async_isFile_000
has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadAsync_IsSocket
_0000
* @tc.name fileio_dir_read_async_is
Directory
_000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_ASYNC_ISSOCKET
_0000
* @tc.name fileio_dir_read_async_is
Socket
_000
* @tc.desc Test Dir.readAsync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_async_is
Directory
_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_is
Directory
_000
'
)
+
'
d
'
;
it
(
'
fileio_dir_read_async_is
Socket
_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_is
Socket
_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);;
let
dir
=
await
dd
.
read
();;
expect
(
isBoolean
(
dir
.
isSocket
())).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_isDirectory_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadAsync_IsSocket_0010
* @tc.name fileio_dir_read_async_isDirectory_001
* @tc.desc Test Dir.readAsync() interface.
*/
it
(
'
fileio_dir_read_async_isDirectory_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_isDirectory_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
dir
.
isSocket
()
===
false
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_isDirectory_001
has failed for
'
+
e
);
console
.
info
(
'
fileio_dir_read_async_isSocket_000
has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_F
ileIO_Dir_ReadAsync_IsSymbolicLink
_0000
* @tc.name fileio_dir_read_async_is
Directory
_000
* @tc.number SUB_DF_F
ILEIO_DIR_READ_ASYNC_ISSYMBOLICLINK
_0000
* @tc.name fileio_dir_read_async_is
SymbolicLink
_000
* @tc.desc Test Dir.readAsync() interface.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_dir_read_async_is
Directory
_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_is
Directory
_000
'
)
+
'
d
'
;
it
(
'
fileio_dir_read_async_is
SymbolicLink
_000
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_is
SymbolicLink
_000
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
isBoolean
(
dir
.
isSymbolicLink
())).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_isDirectory_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_ReadAsync_IsSymbolicLink_0010
* @tc.name fileio_dir_read_async_isDirectory_001
* @tc.desc Test Dir.readAsync() interface.
*/
it
(
'
fileio_dir_read_async_isDirectory_001
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileio_dir_read_async_isDirectory_001
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/f1
'
;
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
dd
=
await
fileio
.
opendir
(
dpath
);
expect
(
dd
!==
null
).
assertTrue
();
let
dir
=
await
dd
.
read
();
expect
(
dir
!=
null
).
assertTrue
();
expect
(
dir
.
isSymbolicLink
()
===
false
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
rmdirSync
(
dpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
fileio
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_dir_read_async_isDirectory_001
has failed for
'
+
e
);
console
.
info
(
'
fileio_dir_read_async_isSymbolicLink_000
has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
...
...
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/close.test.js
浏览文件 @
8c29313a
...
...
@@ -20,47 +20,69 @@ import {
describe
(
'
fileio_close
'
,
function
()
{
/**
* @tc.number SUB_DF_FILEIO_CLOSESYNC_0000
* @tc.name fileio_test_close_sync_000
* @tc.desc Test closeSync() interfaces
* @tc.size MEDIUM(中型)
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_close_sync_000
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileio_test_close_async_000
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
fileio
.
closeSync
(
fd
);
fileio
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
console
.
info
(
'
fileio_test_close_sync_000 has failed for
'
+
e
);
}
})
/**
* @tc.number SUB_DF_FILEIO_CLOSESYNC_0100
* @tc.name fileio_test_close_sync_001
* @tc.desc Test closeSync() interfaces,No parameters.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_close_sync_00
0
'
,
0
,
function
()
{
it
(
'
fileio_test_close_sync_00
1
'
,
0
,
function
()
{
try
{
fileio
.
closeSync
();
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_close_sync_000 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_close_sync_001 has failed for
'
+
e
);
expect
(
e
.
message
==
'
Number of arguments unmatched
'
).
assertTrue
();
}
})
/**
* @tc.number SUB_DF_FILEIO_CLOSESYNC_0010
* @tc.name fileio_test_close_sync_001
* @tc.desc Test closeSync() interfaces
* @tc.size MEDIUM
(中型)
* @tc.desc Test closeSync() interfaces
,fd is illegal.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_close_sync_00
1
'
,
0
,
function
()
{
it
(
'
fileio_test_close_sync_00
2
'
,
0
,
function
()
{
try
{
fileio
.
closeSync
(
-
1
);
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_close_sync_001 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_close_sync_002 has failed for
'
+
e
);
expect
(
e
.
message
==
'
Bad file descriptor
'
).
assertTrue
();
}
})
/**
* @tc.number SUB_DF_FILEIO_CLOSE_ASYNC_0000
* @tc.name fileio_test_close_async_000
* @tc.desc Test close() interfaces
* @tc.size MEDIUM
(中型)
* @tc.desc Test close() interfaces
,return in callback mode.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
...
...
@@ -72,11 +94,11 @@ describe('fileio_close', function () {
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
fileio
.
close
(
fd
,
function
(
err
)
{
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_close_async_000 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_close_async_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
})
...
...
@@ -84,8 +106,8 @@ describe('fileio_close', function () {
/**
* @tc.number SUB_DF_FILEIO_CLOSE_ASYNC_0010
* @tc.name fileio_test_close_async_001
* @tc.desc Test close() interfaces
* @tc.size MEDIUM
(中型)
* @tc.desc Test close() interfaces
,return in promise mode.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
...
...
@@ -96,11 +118,11 @@ describe('fileio_close', function () {
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
expect
(
await
fileio
.
close
(
fd
)
==
null
).
assertTrue
(
);
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
(
);
await
fileio
.
close
(
fd
);
fileio
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_close_async_001 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_close_async_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
})
...
...
@@ -108,20 +130,25 @@ describe('fileio_close', function () {
/**
* @tc.number SUB_DF_FILEIO_CLOSE_ASYNC_0020
* @tc.name fileio_test_close_async_002
* @tc.desc Test close() interfaces
* @tc.size MEDIUM
(中型)
* @tc.desc Test close() interfaces
,there are multiple parameters.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_close_async_002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileio_test_close_async_001
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
await
fileio
.
close
(
-
1
);
expect
(
null
).
assertFail
();
done
(
);
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
fileio
.
close
(
fd
,
2
,
function
(
err
)
{
}
);
}
catch
(
e
)
{
expect
(
!!
e
).
assertTrue
();
console
.
log
(
'
fileio_test_close_async_002 has failed for
'
+
e
);
console
.
info
(
'
fileio_test_close_async_002 has failed for
'
+
e
);
expect
(
e
.
message
==
"
Number of arguments unmatched
"
).
assertTrue
();
fileio
.
unlinkSync
(
fpath
);
done
();
}
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录