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

!6864 【回合monthly】【file_api】修改stat.ino类型判断为BigInt

Merge pull request !6864 from zhuhongtao666/cherry-pick-1670486745
...@@ -112,6 +112,10 @@ function isIntNum(val) { ...@@ -112,6 +112,10 @@ function isIntNum(val) {
return typeof val === 'number' && val % 1 === 0; return typeof val === 'number' && val % 1 === 0;
} }
function isBigInt(val) {
return typeof val === 'bigint';
}
function isString(str) { function isString(str) {
return (typeof str == 'string') && str.constructor == String; return (typeof str == 'string') && str.constructor == String;
} }
...@@ -127,6 +131,7 @@ function isInclude(error, message) { ...@@ -127,6 +131,7 @@ function isInclude(error, message) {
export { export {
fileio, fileio,
isIntNum, isIntNum,
isBigInt,
isString, isString,
isBoolean, isBoolean,
isInclude, isInclude,
......
...@@ -130,16 +130,16 @@ describe('fileIOTestStat', function () { ...@@ -130,16 +130,16 @@ describe('fileIOTestStat', function () {
/** /**
* @tc.number SUB_STORAGE_FileIO_Stat_ino_0000 * @tc.number SUB_STORAGE_FileIO_Stat_ino_0000
* @tc.name fileio_test_stat_ino_000 * @tc.name fileio_test_stat_ino_000
* @tc.desc Function of API. Get inode number. * @tc.desc Function of API. Get inode bigint.
*/ */
it('fileio_test_stat_ino_000', 0, async function () { it('fileio_test_stat_ino_000', 0, async function () {
let fpath = await nextFileName('fileio_test_stat_ino_000'); let fpath = await nextFileName('fileio_test_stat_ino_000');
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try { try {
let stat = fileio.statSync(fpath); let stat = fileio.statSync(fpath);
expect(typeof(stat.ino) == 'number').assertTrue(); expect(typeof(stat.ino) == 'bigint').assertTrue();
fileio.unlinkSync(fpath); fileio.unlinkSync(fpath);
} }
catch (e) { catch (e) {
console.log('fileio_test_stat_ino_000 has failed for ' + e); console.log('fileio_test_stat_ino_000 has failed for ' + e);
expect(null).assertFail(); expect(null).assertFail();
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import { import {
fileio, FILE_CONTENT, prepareFile, nextFileName, isIntNum, isBoolean, fileio, FILE_CONTENT, prepareFile, nextFileName, isIntNum, isBigInt, isBoolean,
describe, it, expect, describe, it, expect,
} from '../../Common'; } from '../../Common';
...@@ -107,7 +107,7 @@ describe('fileio_fstat', function () { ...@@ -107,7 +107,7 @@ describe('fileio_fstat', function () {
try { try {
let fd = fileio.openSync(fpath); let fd = fileio.openSync(fpath);
let stat = fileio.fstatSync(fd); let stat = fileio.fstatSync(fd);
expect(isIntNum(stat.ino)).assertTrue(); expect(isBigInt(stat.ino)).assertTrue();
expect(fileio.closeSync(fd) == null).assertTrue(); expect(fileio.closeSync(fd) == null).assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue();
} catch (e) { } catch (e) {
...@@ -1043,7 +1043,7 @@ describe('fileio_fstat', function () { ...@@ -1043,7 +1043,7 @@ describe('fileio_fstat', function () {
try { try {
let fd = fileio.openSync(fpath); let fd = fileio.openSync(fpath);
let stat = await fileio.fstat(fd); let stat = await fileio.fstat(fd);
expect(isIntNum(stat.ino)).assertTrue(); expect(isBigInt(stat.ino)).assertTrue();
expect(fileio.closeSync(fd) == null).assertTrue(); expect(fileio.closeSync(fd) == null).assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue();
done(); done();
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import { import {
fileio, FILE_CONTENT, prepareFile, nextFileName, isIntNum, isBoolean, fileio, FILE_CONTENT, prepareFile, nextFileName, isIntNum, isBigInt, isBoolean,
describe, it, expect, describe, it, expect,
} from '../../Common'; } from '../../Common';
...@@ -103,7 +103,7 @@ describe('fileio_lstat', function () { ...@@ -103,7 +103,7 @@ describe('fileio_lstat', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try { try {
let stat = fileio.lstatSync(fpath); let stat = fileio.lstatSync(fpath);
expect(isIntNum(stat.ino)).assertTrue(); expect(isBigInt(stat.ino)).assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue();
} catch (e) { } catch (e) {
console.log('fileio_lstat_ino_000 has failed for ' + e); console.log('fileio_lstat_ino_000 has failed for ' + e);
...@@ -992,7 +992,7 @@ describe('fileio_lstat', function () { ...@@ -992,7 +992,7 @@ describe('fileio_lstat', function () {
try { try {
let stat = await fileio.lstat(fpath); let stat = await fileio.lstat(fpath);
expect(isIntNum(stat.ino)).assertTrue(); expect(isBigInt(stat.ino)).assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue();
done(); done();
} catch (e) { } catch (e) {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import { import {
fileio, FILE_CONTENT, prepareFile, nextFileName, isIntNum, isBoolean, fileio, FILE_CONTENT, prepareFile, nextFileName, isIntNum, isBigInt, isBoolean,
describe, it, expect, describe, it, expect,
} from '../../Common'; } from '../../Common';
...@@ -106,7 +106,7 @@ describe('fileio_stat', function () { ...@@ -106,7 +106,7 @@ describe('fileio_stat', function () {
try { try {
let stat = fileio.statSync(fpath); let stat = fileio.statSync(fpath);
expect(isIntNum(stat.ino)).assertTrue(); expect(isBigInt(stat.ino)).assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue();
} catch (e) { } catch (e) {
console.log('fileio_stat_sync_ino_000 has failed for ' + e); console.log('fileio_stat_sync_ino_000 has failed for ' + e);
...@@ -985,7 +985,7 @@ describe('fileio_stat', function () { ...@@ -985,7 +985,7 @@ describe('fileio_stat', function () {
try { try {
let stat = await fileio.stat(fpath); let stat = await fileio.stat(fpath);
expect(isIntNum(stat.ino)).assertTrue(); expect(isBigInt(stat.ino)).assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue();
done(); done();
} catch (e) { } catch (e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册