提交 39074cd3 编写于 作者: B bayanxing

description:add test cases

Signed-off-by: Nbayanxing <bayanxing@kaihongdigi.com>
上级 5db112df
......@@ -3826,4 +3826,37 @@ describe('fileIOTest', function () {
expect(null).assertFail();
}
});
/**
* @tc.number SUB_STORAGE_FileIO_stat_promise_000
* @tc.name fileio_test_stat_promise_000
* @tc.desc obtain file propertys by stat promise
*/
it('fileio_test_stat_promise_000', 0, async function () {
let fpath = await nextFileName('fileio_test_stat_promise_000');
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
expect(fileio.chmodSync(fpath, 0o660) !== null).assertTrue();
let stat = await fileio.stat(fpath).then(()=> {
expect((stat.mode & 0o777) == 0o660).assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
console.log('file stat Success');
}).catch((err) => {
console.log("file stat err: " + JSON.stringify(err));
});
});
/**
* @tc.number fileio_test_stat_async_000
* @tc.name fileio_test_stat_async_000
* @tc.desc Function of API, obtain file propertys by stat async
*/
it('fileio_test_stat_async_000', 0, async function () {
let fpath = await nextFileName('fileio_test_stat_async_000');
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
expect(fileio.chmodSync(fpath, 0o660) !== null).assertTrue();
fileio.stat(fpath, function (err, stat) {
expect((stat.mode & 0o777) == 0o660).assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
});
});
});
\ No newline at end of file
......@@ -155,6 +155,39 @@ describe('fileIOTestDir', function () {
}
});
/**
* @tc.number SUB_STORAGE_FileIO_dir_OpenASync_001
* @tc.name fileio_test_dir_open_async_001
* @tc.desc Function of API, file name contain special character.
*/
it('fileio_test_dir_open_async_001', 0, async function () {
let dpath = await nextFileName('fileio_test_dir_open_async_001') + 'd'
expect(fileio.mkdirSync(dpath) !== null).assertTrue();
fileio.opendir(dpath, function (err, dir) {
expect(dir !== null).assertTrue();
expect(dir.closeSync() == null).assertTrue();
expect(fileio.rmdirSync(dpath) !== null).assertTrue();
});
});
/**
* @tc.number SUB_STORAGE_FileIO_dir_OpenASync_001
* @tc.name fileio_test_dir_open_async_001
* @tc.desc Function of API, file name contain special character.
*/
it('fileio_test_dir_open_async_002', 0, async function () {
let dpath = await nextFileName('fileio_test_dir_open_async_002') + 'd'
expect(fileio.mkdirSync(dpath) !== null).assertTrue();
let dir = await fileio.opendir(dpath).then(()=> {
expect(dir !== null).assertTrue();
expect(dir.closeSync() == null).assertTrue();
expect(fileio.rmdirSync(dpath) !== null).assertTrue();
console.log('fileio opendir Success');
}).catch((err) => {
console.log("fileio opendir err: " + JSON.stringify(err));
});
});
/**
* @tc.number SUB_STORAGE_FileIO_dir_ReadSync_0000
* @tc.name fileio_test_dir_read_sync_000
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册