Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
5a4cd7d3
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看板
提交
5a4cd7d3
编写于
1月 21, 2022
作者:
R
raoxian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fileio新增close,fdatasyncSync测试用例
Signed-off-by:
N
raoxian
<
raoxian@huawei.com
>
上级
fa849d09
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
117 addition
and
26 deletion
+117
-26
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/close.test.js
.../main/js/default/test/module_fileio/members/close.test.js
+71
-1
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fdatasync.test.js
...n/js/default/test/module_fileio/members/fdatasync.test.js
+46
-25
未找到文件。
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/close.test.js
浏览文件 @
5a4cd7d3
...
...
@@ -15,7 +15,7 @@
import
{
fileio
,
describe
,
it
,
expect
,
describe
,
it
,
expect
,
nextFileName
,
prepareFile
,
FILE_CONTENT
}
from
'
../../Common
'
;
describe
(
'
fileio_close
'
,
function
()
{
...
...
@@ -55,4 +55,74 @@ describe('fileio_close', function () {
console
.
log
(
'
fileio_test_close_sync_001 has failed for
'
+
e
);
}
})
/**
* @tc.number SUB_DF_FILEIO_CLOSE_ASYNC_0000
* @tc.name fileio_test_close_async_000
* @tc.desc Test close() interfaces
* @tc.size MEDIUM(中型)
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_close_async_000
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileio_test_close_async_000
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
fileio
.
close
(
fd
,
function
(
err
)
{
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_close_async_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
})
/**
* @tc.number SUB_DF_FILEIO_CLOSE_ASYNC_0010
* @tc.name fileio_test_close_async_001
* @tc.desc Test close() interfaces
* @tc.size MEDIUM(中型)
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_close_async_001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileio_test_close_async_001
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
expect
(
await
fileio
.
close
(
fd
)
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_close_async_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
})
/**
* @tc.number SUB_DF_FILEIO_CLOSE_ASYNC_0020
* @tc.name fileio_test_close_async_002
* @tc.desc Test close() interfaces
* @tc.size MEDIUM(中型)
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_close_async_002
'
,
0
,
async
function
(
done
)
{
try
{
await
fileio
.
close
(
-
1
);
expect
(
null
).
assertFail
();
done
();
}
catch
(
e
)
{
expect
(
!!
e
).
assertTrue
();
console
.
log
(
'
fileio_test_close_async_002 has failed for
'
+
e
);
done
();
}
})
})
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fdatasync.test.js
浏览文件 @
5a4cd7d3
...
...
@@ -48,7 +48,7 @@ describe('fileio_fdatasync', async function () {
/**
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0010
* @tc.name fileio_test_fdatasync_async_001
* @tc.desc Test fdatasync
Sync
() interfaces.
* @tc.desc Test fdatasync() interfaces.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
...
...
@@ -60,11 +60,17 @@ describe('fileio_fdatasync', async function () {
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
fileio
.
write
(
fd
,
FILE_CONTENT
);
fileio
.
fdatasync
(
fd
)
.
then
(
function
(
err
)
{
expect
(
fileio
.
closeSync
(
fd
)
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
})
.
catch
(
function
(
err
)
{
expect
(
null
).
assertFail
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_fdatasync_async_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
...
...
@@ -78,46 +84,61 @@ describe('fileio_fdatasync', async function () {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_fdatasync_async_002
'
,
0
,
async
function
(
)
{
it
(
'
fileio_test_fdatasync_async_002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileio_test_fdatasync_async_002
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
fileio
.
fdatasync
(
fd
)
.
then
(
function
(
err
)
{
expect
(
fileio
.
closeSync
(
fd
)
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
})
.
catch
(
function
(
err
)
{
let
fd
=
-
1
;
await
fileio
.
fdatasync
(
fd
);
expect
(
null
).
assertFail
();
});
done
()
}
catch
(
e
)
{
expect
(
!!
e
).
assertTrue
();
console
.
log
(
'
fileio_test_fdatasync_async_002 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
done
();
}
});
/**
* @tc.number SUB_DF_FILEIO_FDATASYNC_
ASYNC_003
0
* @tc.name fileio_test_fdatasync_
async_003
* @tc.desc Test fdatasync() interfaces.
* @tc.number SUB_DF_FILEIO_FDATASYNC_
SYNC_000
0
* @tc.name fileio_test_fdatasync_
sync_000
* @tc.desc Test fdatasync
Sync
() interfaces.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_fdatasync_
async_003
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileio_test_fdatasync_
async_003
'
);
it
(
'
fileio_test_fdatasync_
sync_000
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileio_test_fdatasync_
sync_000
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
fd
=
-
1
;
await
fileio
.
fdatasync
(
fd
);
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
expect
(
fileio
.
fdatasyncSync
(
fd
)
==
null
).
assertTrue
();
expect
(
fileio
.
closeSync
(
fd
)
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_fdatasync_sync_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FILEIO_FDATASYNC_SYNC_0010
* @tc.name fileio_test_fdatasync_sync_001
* @tc.desc Test fdatasyncSync() interfaces.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_fdatasync_sync_001
'
,
0
,
async
function
()
{
try
{
fileio
.
fdatasyncSync
(
-
1
);
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_fdatasync_
async_003
has failed for
'
+
e
);
console
.
log
(
'
fileio_test_fdatasync_
sync_001
has failed for
'
+
e
);
}
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录