From 1f2eaf2609141c6b646a311a4f0549fbdda2d971 Mon Sep 17 00:00:00 2001 From: zhuhongtao66 Date: Thu, 8 Dec 2022 15:11:48 +0800 Subject: [PATCH] fixed 08aa5a4 from https://gitee.com/zhuhongtao66/xts_acts/pulls/6861 modefied the type of stat.ino can be bigint Signed-off-by: zhuhongtao66 --- storage/storagefileiojstest/src/main/js/test/Common.js | 5 +++++ .../storagefileiojstest/src/main/js/test/FileIOStat.test.js | 6 +++--- .../src/main/js/test/module_fileio/members/fstat.test.js | 6 +++--- .../src/main/js/test/module_fileio/members/lstat.test.js | 6 +++--- .../src/main/js/test/module_fileio/members/stat.test.js | 6 +++--- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/storage/storagefileiojstest/src/main/js/test/Common.js b/storage/storagefileiojstest/src/main/js/test/Common.js index ab53cac8a..aed7ef789 100644 --- a/storage/storagefileiojstest/src/main/js/test/Common.js +++ b/storage/storagefileiojstest/src/main/js/test/Common.js @@ -112,6 +112,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; } @@ -127,6 +131,7 @@ function isInclude(error, message) { export { fileio, isIntNum, + isBigInt, isString, isBoolean, isInclude, diff --git a/storage/storagefileiojstest/src/main/js/test/FileIOStat.test.js b/storage/storagefileiojstest/src/main/js/test/FileIOStat.test.js index e35d4772f..acf278d91 100644 --- a/storage/storagefileiojstest/src/main/js/test/FileIOStat.test.js +++ b/storage/storagefileiojstest/src/main/js/test/FileIOStat.test.js @@ -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(); diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/fstat.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/fstat.test.js index 1179f9c5c..ef601a783 100644 --- a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/fstat.test.js +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/fstat.test.js @@ -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(); diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/lstat.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/lstat.test.js index e0a70d53e..4524ac9d9 100644 --- a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/lstat.test.js +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/lstat.test.js @@ -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) { diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/stat.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/stat.test.js index 8ea44de21..2e7c739c5 100644 --- a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/stat.test.js +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/stat.test.js @@ -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) { -- GitLab