提交 3d72a168 编写于 作者: R raoxian

update fileio

Signed-off-by: Nraoxian <raoxian@huawei.com>
上级 0850acac
...@@ -130,7 +130,8 @@ describe('FileIOError', function () { ...@@ -130,7 +130,8 @@ describe('FileIOError', function () {
} }
catch (err) { catch (err) {
console.info('fileio_test_error_004 has failed for ' + err); console.info('fileio_test_error_004 has failed for ' + err);
expect(isInclude(err.message, 'Symbolic link loop') || isInclude(err.message, 'Too many symbolic links encountered')).assertTrue(); expect(isInclude(err.message, 'Symbolic link loop') ||
isInclude(err.message, 'Too many symbolic links encountered')).assertTrue();
fileio.unlinkSync(fpath); fileio.unlinkSync(fpath);
fileio.unlinkSync(ffpath); fileio.unlinkSync(ffpath);
done(); done();
......
...@@ -495,16 +495,15 @@ describe('fileIOTest', function () { ...@@ -495,16 +495,15 @@ describe('fileIOTest', function () {
* @tc.name fileio_test_open_019 * @tc.name fileio_test_open_019
* @tc.desc Function of API, flags=0o40002. mode=0o700 * @tc.desc Function of API, flags=0o40002. mode=0o700
*/ */
it('fileio_test_open_019', 0, async function () { it('fileio_test_open_019', 0, async function () {
let fpath = await nextFileName('fileio_test_open_019'); let fpath = await nextFileName('fileio_test_open_019');
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try { try {
fileio.openSync(fpath, 0o40002, 0o700); fileio.openSync(fpath, 0o40002, 0o700);
fileio.unlinkSync(fpath);
}catch (err) {
console.info('fileio_test_open_019 has failed for ' + err);
expect(null).assertFail(); expect(null).assertFail();
}
catch (e) {
console.log('fileio_test_open_019 has failed for ' + e);
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
} }
}); });
...@@ -531,19 +530,17 @@ describe('fileIOTest', function () { ...@@ -531,19 +530,17 @@ describe('fileIOTest', function () {
/** /**
* @tc.number SUB_STORAGE_FileIO_OpenSync_2200 * @tc.number SUB_STORAGE_FileIO_OpenSync_2200
* @tc.name fileio_test_open_022 * @tc.name fileio_test_open_022
* @tc.desc Function of API, flags=0o200002. * @tc.desc Function of API, flags=0o200000.
*/ */
it('fileio_test_open_022', 0, async function () { it('fileio_test_open_022', 0, async function () {
let fpath = await nextFileName('fileio_test_open_022'); let dpath = await nextFileName('fileio_test_open_022') + 'd';
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); fileio.mkdirSync(dpath);
try { try {
let fd = fileio.openSync(fpath, 0o200002); fileio.openSync(dpath, 0o200000, 0o666);
expect(fd !== null).assertTrue(); fileio.rmdirSync(dpath);
expect(fileio.closeSync(fd) !== null).assertTrue(); }
expect(fileio.unlinkSync(fpath) !== null).assertTrue(); catch (err) {
} console.info('fileio_test_open_022 has failed for ' + err);
catch (e) {
console.log('fileio_test_open_022 has failed for ' + e);
expect(null).assertFail(); expect(null).assertFail();
} }
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册