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

!6861 Modefied the type of stat.ino to be BigInt

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