提交 de5faf07 编写于 作者: F fengjq

Add XTS for fs.Watcher interface

Signed-off-by: Nfengjq <fengjunqing@huawei.com>
上级 5b633153
...@@ -83,6 +83,13 @@ export function randomString(num) { ...@@ -83,6 +83,13 @@ export function randomString(num) {
return pwd; return pwd;
} }
export async function sleep(times) {
if (!times) {
times = 10;
}
await new Promise((res) => setTimeout(res, times));
}
function isIntNum(val) { function isIntNum(val) {
return typeof val === 'number' && val % 1 === 0; return typeof val === 'number' && val % 1 === 0;
} }
......
...@@ -42,6 +42,7 @@ import fileIOStreamWrite from './class_stream/write.test.js' ...@@ -42,6 +42,7 @@ import fileIOStreamWrite from './class_stream/write.test.js'
import fileIOSymlink from './members/symlink.test.js' import fileIOSymlink from './members/symlink.test.js'
import fileIOTruncate from './members/truncate.test.js' import fileIOTruncate from './members/truncate.test.js'
import fileIOUnlink from './members/unlink.test.js' import fileIOUnlink from './members/unlink.test.js'
import fileIOWatcher from './members/watcher.test.js'
import fileIOWrite from './members/write.test.js' import fileIOWrite from './members/write.test.js'
import fileIORW from './members/filerw.test.js' import fileIORW from './members/filerw.test.js'
export default function testsuite() { export default function testsuite() {
...@@ -74,6 +75,7 @@ export default function testsuite() { ...@@ -74,6 +75,7 @@ export default function testsuite() {
fileIOSymlink() fileIOSymlink()
fileIOTruncate() fileIOTruncate()
fileIOUnlink() fileIOUnlink()
fileIOWatcher()
fileIOWrite() fileIOWrite()
fileIORW() fileIORW()
} }
...@@ -224,9 +224,10 @@ describe('fileIO_fs_mkdir', function () { ...@@ -224,9 +224,10 @@ describe('fileIO_fs_mkdir', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try { try {
await fileIO.mkdirSync(fpath); await fileIO.mkdir(fpath);
expect(false).assertTrue(); expect(false).assertTrue();
} catch (e) { } catch (e) {
fileIO.unlinkSync(fpath);
console.log('fileIO_test_mkdir_async_004 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_mkdir_async_004 has failed for ' + e.message + ', code: ' + e.code);
expect(e.code == 13900015 && e.message == 'File exists').assertTrue(); expect(e.code == 13900015 && e.message == 'File exists').assertTrue();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册