Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
794c5373
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看板
提交
794c5373
编写于
12月 02, 2021
作者:
O
openharmony_ci
提交者:
Gitee
12月 02, 2021
浏览文件
操作
浏览文件
下载
差异文件
!1263 storagefileiojstest下file.test.js测试用例还原
Merge pull request !1263 from 霸霸/master
上级
e2ea2159
20b08b66
变更
4
展开全部
显示空白变更内容
内联
并排
Showing
4 changed file
with
3832 addition
and
5 deletion
+3832
-5
storage/storagefileiojstest/src/main/js/default/test/Common.js
...ge/storagefileiojstest/src/main/js/default/test/Common.js
+3
-3
storage/storagefileiojstest/src/main/js/default/test/File.test.js
...storagefileiojstest/src/main/js/default/test/File.test.js
+3789
-0
storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js
...oragefileiojstest/src/main/js/default/test/FileIO.test.js
+39
-2
storage/storagefileiojstest/src/main/js/default/test/List.test.js
...storagefileiojstest/src/main/js/default/test/List.test.js
+1
-0
未找到文件。
storage/storagefileiojstest/src/main/js/default/test/Common.js
浏览文件 @
794c5373
...
...
@@ -70,15 +70,15 @@ export function fileToWriteOnly(fpath) {
}
export
function
nextFileName
(
testName
)
{
const
BASE_PATH
=
'
/data/accounts/account_0/appdata/ohos.acts.storage.fileio/cache/
'
return
BASE_PATH
+
testName
+
'
_
'
+
randomString
(
testName
.
length
);
return
BASE_PATH
+
testName
}
export
function
fileName
(
testName
)
{
const
BASE_PATH
=
'
/data/accounts/account_0/appdata/ohos.acts.storage.fileio/files/
'
return
BASE_PATH
+
testName
+
'
_
'
+
randomString
(
testName
.
length
);
return
BASE_PATH
+
testName
}
export
function
cacheFileName
(
testName
)
{
const
BASE_PATH
=
'
/data/accounts/account_0/appdata/ohos.acts.storage.fileio/files/cache/
'
return
BASE_PATH
+
testName
+
'
_
'
+
randomString
(
testName
.
length
);
return
BASE_PATH
+
testName
}
export
function
sleep
(
n
)
{
...
...
storage/storagefileiojstest/src/main/js/default/test/File.test.js
0 → 100644
浏览文件 @
794c5373
此差异已折叠。
点击以展开。
storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js
浏览文件 @
794c5373
...
...
@@ -14,6 +14,7 @@
*/
import
fileio
from
'
@ohos.fileio
'
;
import
file
from
'
@system.file
'
;
import
{
describe
,
beforeAll
,
...
...
@@ -1577,6 +1578,40 @@ describe('fileIOTest', function () {
}
});
/**
* @tc.number SUB_STORAGE_FileIO_ReadSync_0000
* @tc.name fileio_test_read_sync_000
* @tc.desc Function of API, readSync.
*/
it
(
"
fileio_test_read_sync_000
"
,
0
,
async
function
(
done
)
{
let
fpath
=
nextFileName
(
"
fileio_test_read_sync_000
"
);
let
text
=
"
0123456789abcdefg
"
;
expect
(
prepareFile
(
fpath
,
text
)).
assertTrue
();
sleep
(
10
);
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o2
);
let
len
=
fileio
.
readSync
(
fd
,
new
ArrayBuffer
(
4096
));
expect
(
len
==
text
.
length
).
assertTrue
();
expect
(
fileio
.
closeSync
(
fd
)
!==
null
).
assertTrue
();
file
.
readText
({
uri
:
"
internal://cache/fileio_test_read_sync_000
"
,
success
:
function
(
data
)
{
console
.
log
(
"
call readText success:
"
+
data
.
text
);
expect
(
text
==
data
.
text
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
();
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
error
(
"
call fail callback fail, code:
"
+
code
+
"
, data:
"
+
data
);
expect
(
null
).
assertFail
();
},
});
}
catch
(
e
)
{
console
.
log
(
"
fileio_test_read_sync_000 has failed for
"
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_STORAGE_FileIO_ReadSync_0100
* @tc.name fileio_test_read_sync_001
...
...
@@ -2469,7 +2504,8 @@ describe('fileIOTest', function () {
/**
* @tc.number SUB_STORAGE_FileIO_RenameSync_0000
* @tc.name fileio_test_rename_sync_000
* @tc.desc Function of API, renameSync. The test file is exist, fpathTarget is not same with fpatch, file name are same.
* @tc.desc Function of API, renameSync. The test file is exist,
* fpathTarget is not same with fpatch, file name are same.
*/
it
(
'
fileio_test_rename_sync_000
'
,
0
,
function
()
{
let
fpath
=
nextFileName
(
'
fileio_test_rename_sync_000
'
);
...
...
@@ -2489,7 +2525,8 @@ describe('fileIOTest', function () {
/**
* @tc.number SUB_STORAGE_FileIO_RenameSync_0100
* @tc.name fileio_test_rename_sync_001
* @tc.desc Function of API, renameSync. The test file is not exist, fpathTarget is not same with fpatch, file name are same.
* @tc.desc Function of API, renameSync. The test file is not exist,
* fpathTarget is not same with fpatch, file name are same.
*/
it
(
'
fileio_test_rename_sync_001
'
,
0
,
function
()
{
let
fpath
=
nextFileName
(
'
fileio_test_rename_sync_001
'
);
...
...
storage/storagefileiojstest/src/main/js/default/test/List.test.js
浏览文件 @
794c5373
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
require
(
'
./File.test.js
'
)
require
(
'
./FileIO.test.js
'
)
require
(
'
./FileIODir.test.js
'
)
require
(
'
./FileIODirent.test.js
'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录