未验证 提交 48e0d0f9 编写于 作者: O openharmony_ci 提交者: Gitee

!8247 fileapi 增加write接口入参检查,原有错误码调整

Merge pull request !8247 from zhuhongtao666/bugfix1
......@@ -751,14 +751,13 @@ export default function fileIORead() {
try {
fileIO.read(-1, new ArrayBuffer(4096), (err) => {
if(err) {
console.log('fileIO_test_read_async_013 error: {message: ' + err.message + ', code: ' + err.code + '}');
expect(err.code == 13900020 && err.message == 'Invalid argument').assertTrue();
done();
expect(false).assertTrue();
}
});
} catch (e) {
console.log('fileIO_test_read_async_013 has failed for ' + e.message + ', code: ' + e.code);
expect(false).assertTrue();
expect(e.code == 13900020 && e.message == 'Invalid argument').assertTrue();
done();
}
});
......
......@@ -238,7 +238,7 @@ export default function fileIOWrite() {
expect(false).assertTrue();
} catch (e) {
console.log('fileIO_test_write_sync_007 has failed for ' + e.message + ', code: ' + e.code);
expect(e.code == 13900008 && e.message == 'Bad file descriptor').assertTrue();
expect(e.code == 13900020 && e.message == 'Invalid argument').assertTrue();
}
});
......@@ -850,7 +850,7 @@ export default function fileIOWrite() {
} catch (e) {
fileIO.unlinkSync(fpath);
console.log('fileIO_test_write_async_016 has failed for ' + e.message + ', code: ' + e.code);
expect(e.code == 13900008 && e.message == 'Bad file descriptor').assertTrue();
expect(e.code == 13900020 && e.message == 'Invalid argument').assertTrue();
done();
}
});
......@@ -871,15 +871,13 @@ export default function fileIOWrite() {
try {
fileIO.write(-1, FILE_CONTENT, (err) => {
if(err) {
fileIO.unlinkSync(fpath);
console.log('fileIO_test_open_async_020 error: {message: ' + err.message + ', code: ' + err.code + '}');
expect(err.code == 13900008 && err.message == 'Bad file descriptor').assertTrue();
done();
}
expect(false).assertTrue();
});
} catch (e) {
fileIO.unlinkSync(fpath);
console.log('fileIO_test_write_async_017 has failed for ' + e.message + ', code: ' + e.code);
expect(e.code == 13900020 && e.message == 'Invalid argument').assertTrue();
done();
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册