From 0de230e01efa8678d4d7a8b2cacc2b44f8a95a3f Mon Sep 17 00:00:00 2001 From: futurezhou Date: Tue, 10 Jan 2023 09:07:18 +0800 Subject: [PATCH] fixed a735454 from https://gitee.com/futurezhou/xts_acts/pulls/7165 bugfix for xts Signed-off-by: futurezhou --- .../src/main/js/test/FileIO.test.js | 4 ++-- .../test/module_fileio/class_stream/close.test.js | 8 ++++---- .../test/module_fileio/class_stream/flush.test.js | 4 ++-- .../module_fileio/members/createStream.test.js | 4 ++-- .../js/test/module_fileio/members/open.test.js | 14 +++++++------- .../js/test/module_fileio/members/readtext.test.js | 6 +++--- .../js/test/module_fileio/members/rename.test.js | 6 +++--- .../js/test/module_fileio/members/symlink.test.js | 2 +- .../js/test/module_fileio/members/write.test.js | 10 +++++----- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/storage/storagefileiojstest/src/main/js/test/FileIO.test.js b/storage/storagefileiojstest/src/main/js/test/FileIO.test.js index 2edd2c2ef..86b54e24d 100644 --- a/storage/storagefileiojstest/src/main/js/test/FileIO.test.js +++ b/storage/storagefileiojstest/src/main/js/test/FileIO.test.js @@ -4054,7 +4054,7 @@ export default function fileIOTest() { let fpath = await nextFileName('fileio_test_stat_promise_011'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); fileio.chmodSync(fpath, 0o640); - await fileio.stat(fpath).then((stat)=> { + fileio.stat(fpath).then((stat)=> { expect((stat.mode & 0o777) == 0o640).assertTrue(); fileio.unlinkSync(fpath); console.info('file stat Success'); @@ -4314,7 +4314,7 @@ export default function fileIOTest() { let fpath = await nextFileName('fileio_test_close_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let fd = fileio.openSync(fpath); - await fileio.close(fd, function (err) { + fileio.close(fd, function (err) { fileio.unlinkSync(fpath); }); }); diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/class_stream/close.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/class_stream/close.test.js index 59406a6b2..493c7a5c8 100644 --- a/storage/storagefileiojstest/src/main/js/test/module_fileio/class_stream/close.test.js +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/class_stream/close.test.js @@ -84,8 +84,8 @@ describe('fileio_stream_close', function () { expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { - let fd = await fileio.openSync(fpath, 0o2); - let ss = await fileio.fdopenStreamSync(fd, 'r+'); + let fd = fileio.openSync(fpath, 0o2); + let ss = fileio.fdopenStreamSync(fd, 'r+'); expect(ss !== null).assertTrue(); await ss.close(); fileio.unlinkSync(fpath); @@ -110,8 +110,8 @@ describe('fileio_stream_close', function () { expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { - let fd = await fileio.openSync(fpath, 0o2); - let ss = await fileio.fdopenStreamSync(fd, 'r+'); + let fd = fileio.openSync(fpath, 0o2); + let ss = fileio.fdopenStreamSync(fd, 'r+'); expect(ss !== null).assertTrue(); ss.close(function (err) { fileio.unlinkSync(fpath); diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/class_stream/flush.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/class_stream/flush.test.js index 68273dd44..62eab7098 100644 --- a/storage/storagefileiojstest/src/main/js/test/module_fileio/class_stream/flush.test.js +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/class_stream/flush.test.js @@ -87,7 +87,7 @@ describe('fileio_stream_flush', function () { expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { - let ss = await fileio.createStreamSync(fpath, 'r+'); + let ss = fileio.createStreamSync(fpath, 'r+'); expect(ss !== null).assertTrue(); expect(ss.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue(); ss.flush().then( @@ -116,7 +116,7 @@ describe('fileio_stream_flush', function () { expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { - let ss = await fileio.createStreamSync(fpath, 'r+'); + let ss = fileio.createStreamSync(fpath, 'r+'); expect(ss !== null).assertTrue(); expect(ss.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue(); ss.flush(function (err) { diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/createStream.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/createStream.test.js index f9f2418c9..a73b4ab4e 100644 --- a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/createStream.test.js +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/createStream.test.js @@ -61,7 +61,7 @@ describe('fileio_createStream', function () { expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { - await fileio.createStream(fpath, 'r+', function (err, stream) { + fileio.createStream(fpath, 'r+', function (err, stream) { expect(stream.closeSync() == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); done(); @@ -86,7 +86,7 @@ describe('fileio_createStream', function () { expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { - await fileio.createStream(fpath, 'r+', function (err, stream) { + fileio.createStream(fpath, 'r+', function (err, stream) { expect(stream.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue(); expect(stream.closeSync() == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/open.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/open.test.js index 8a3adc8e6..b88799f55 100644 --- a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/open.test.js +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/open.test.js @@ -57,7 +57,7 @@ describe('fileio_open', function () { fileio.open(fpath, 0, 0o0400, function (err, fd) { fileio.read(fd, new ArrayBuffer(4096)) .then(function (res) { - expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue; + expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue(); expect(res.bytesRead == FILE_CONTENT.length).assertTrue(); fileio.closeSync(fd); fileio.unlinkSync(fpath); @@ -87,7 +87,7 @@ describe('fileio_open', function () { await fileio.open(fpath, 0, 0o0400, function (err, fd) { fileio.read(fd, new ArrayBuffer(4096)) .then(function (res) { - expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue; + expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue(); expect(res.bytesRead == FILE_CONTENT.length).assertTrue(); fileio.closeSync(fd); fileio.unlinkSync(fpath); @@ -116,7 +116,7 @@ describe('fileio_open', function () { await fileio.open(fpath, 0, function (err, fd) { fileio.read(fd, new ArrayBuffer(4096)) .then(function (res) { - expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue; + expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue(); expect(res.bytesRead == FILE_CONTENT.length).assertTrue(); fileio.closeSync(fd); fileio.unlinkSync(fpath); @@ -145,7 +145,7 @@ describe('fileio_open', function () { fileio.open(fpath, 0o2, function (err, fd) { fileio.read(fd, new ArrayBuffer(4096)) .then(function (res) { - expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue; + expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue(); expect(res.bytesRead == FILE_CONTENT.length).assertTrue(); fileio.closeSync(fd); fileio.unlinkSync(fpath); @@ -175,7 +175,7 @@ describe('fileio_open', function () { .then(function (fd) { fileio.read(fd, new ArrayBuffer(4096)) .then(function (res) { - expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue; + expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue(); expect(res.bytesRead == FILE_CONTENT.length).assertTrue(); fileio.closeSync(fd); fileio.unlinkSync(fpath); @@ -207,7 +207,7 @@ describe('fileio_open', function () { .then(function (fd) { fileio.read(fd, new ArrayBuffer(4096)) .then(function (res) { - expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue; + expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue(); expect(res.bytesRead == FILE_CONTENT.length).assertTrue(); fileio.closeSync(fd); fileio.unlinkSync(fpath); @@ -239,7 +239,7 @@ describe('fileio_open', function () { .then(function (fd) { fileio.read(fd, new ArrayBuffer(4096)) .then(function (res) { - expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue; + expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue(); expect(res.bytesRead == FILE_CONTENT.length).assertTrue(); fileio.closeSync(fd); fileio.unlinkSync(fpath); diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/readtext.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/readtext.test.js index 67d4727df..3cd246572 100644 --- a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/readtext.test.js +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/readtext.test.js @@ -171,7 +171,7 @@ describe('fileio_readtext', function () { expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { - await fileio.readText(fpath, { position: pos, length: len, encoding: 'UTF-8' }, function (err, str) { + fileio.readText(fpath, { position: pos, length: len, encoding: 'UTF-8' }, function (err, str) { expect(str == FILE_CONTENT.substr(pos, len)).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); done(); @@ -198,7 +198,7 @@ describe('fileio_readtext', function () { expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { - await fileio.readText(fpath, { position: 1 }, function (err, str) { + fileio.readText(fpath, { position: 1 }, function (err, str) { expect(str == FILE_CONTENT.substr(pos, len)).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); done(); @@ -225,7 +225,7 @@ describe('fileio_readtext', function () { expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { - await fileio.readText(fpath, { position: 1 }, function (err, str) { + fileio.readText(fpath, { position: 1 }, function (err, str) { expect(str == FILE_CONTENT.substr(pos, len)).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); }); diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/rename.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/rename.test.js index a8a624e3d..f54e9f996 100644 --- a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/rename.test.js +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/rename.test.js @@ -35,7 +35,7 @@ describe('fileio_rename', function () { try { let newf = fpath + '123'; - await fileio.rename(fpath, newf) + fileio.rename(fpath, newf) .then(function (err) { expect(fileio.accessSync(newf) == null).assertTrue(); expect(err == null).assertTrue(); @@ -65,7 +65,7 @@ describe('fileio_rename', function () { try { let newf = fpath + 'aaa'; - await fileio.rename(fpath, newf, function (err) { + fileio.rename(fpath, newf, function (err) { expect(fileio.accessSync(newf) == null).assertTrue(); expect(fileio.unlinkSync(newf) == null).assertTrue(); done(); @@ -89,7 +89,7 @@ describe('fileio_rename', function () { expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { - await fileio.access(fpath).then(function (err) { + fileio.access(fpath).then(function (err) { let newf = fpath + '123'; fileio.rename(fpath, newf) .then(function (err) { diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/symlink.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/symlink.test.js index a6fb5d938..a779d84d2 100644 --- a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/symlink.test.js +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/symlink.test.js @@ -86,7 +86,7 @@ describe('fileio_symlink', function () { expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { - await fileio.symlink(fpath, fpath + 'pass2', function (err) { + fileio.symlink(fpath, fpath + 'pass2', function (err) { fileio.accessSync(fpath + 'pass2'); fileio.unlinkSync(fpath); fileio.unlinkSync(fpath + 'pass2'); diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/write.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/write.test.js index cd6739a46..c333ca627 100644 --- a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/write.test.js +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/write.test.js @@ -435,7 +435,7 @@ describe('fileio_write', function () { try { let fd = fileio.openSync(fpath, 0o102, 0o666); expect(isIntNum(fd)).assertTrue(); - await fileio.write(fd, new ArrayBuffer(4096), function ( + fileio.write(fd, new ArrayBuffer(4096), function ( error, bytesWritten ) { @@ -465,7 +465,7 @@ describe('fileio_write', function () { try { let fd = fileio.openSync(fpath, 0o102, 0o666); expect(isIntNum(fd)).assertTrue(); - await fileio.write( + fileio.write( fd, FILE_CONTENT, { @@ -498,7 +498,7 @@ describe('fileio_write', function () { try { let fd = fileio.openSync(fpath, 0o102, 0o666); expect(isIntNum(fd)).assertTrue(); - await fileio.write( + fileio.write( fd, FILE_CONTENT, { @@ -532,7 +532,7 @@ describe('fileio_write', function () { try { let fd = fileio.openSync(fpath, 0o102, 0o666); expect(isIntNum(fd)).assertTrue(); - await fileio.write( + fileio.write( fd, FILE_CONTENT, { @@ -567,7 +567,7 @@ describe('fileio_write', function () { try { let fd = fileio.openSync(fpath, 0o102, 0o666); expect(isIntNum(fd)).assertTrue(); - await fileio.write( + fileio.write( fd, FILE_CONTENT, { -- GitLab