提交 905cff78 编写于 作者: R raoxian

update storagefileiojstest

Signed-off-by: Nraoxian <raoxian@huawei.com>
上级 a5141467
......@@ -38,11 +38,11 @@ describe('fileIOTestDir', function () {
it('fileio_test_dir_open_sync_000', 0, async function () {
let dpath = await nextFileName('fileio_test_dir_open_sync_000') + 'd'
try {
expect(fileio.mkdirSync(dpath) !== null).assertTrue();
fileio.mkdirSync(dpath);
let dd = fileio.opendirSync(dpath);
expect(dd !== null).assertTrue();
expect(dd.closeSync() == null).assertTrue();
expect(fileio.rmdirSync(dpath) !== null).assertTrue();
dd.closeSync();
fileio.rmdirSync(dpath);
}
catch (e) {
console.log('fileio_test_dir_open_sync_000 has failed for ' + e);
......@@ -71,13 +71,14 @@ describe('fileIOTestDir', function () {
* @tc.desc Function of API, dpath value is not exist.
*/
it('fileio_test_dir_open_sync_002', 0, async function () {
let dpath = await nextFileName('fileio_test_dir_open_sync_003') + 'd'
let dpath = await nextFileName('fileio_test_dir_open_sync_002') + 'd'
try {
fileio.opendirSync(dpath);
expect(null).assertFail();
}
catch (e) {
console.log('fileio_test_dir_open_sync_002 has failed for ' + e);
expect(e.message == 'No such file or directory').assertTrue();
}
});
......@@ -87,7 +88,7 @@ describe('fileIOTestDir', function () {
* @tc.desc Function of API, dpath too long.
*/
it('fileio_test_dir_open_sync_003', 0, async function () {
let dpath = await nextFileName('fileio_dir11');
let dpath = await nextFileName('fileio_test_dir_open_sync_003');
fileio.mkdirSync(dpath);
try {
for (let i = 0; i < 16; i++) {
......@@ -124,7 +125,7 @@ describe('fileIOTestDir', function () {
* @tc.desc Function of API, uri dir too many layers.
*/
it('fileio_test_dir_open_sync_005', 0, async function () {
let dpath = await nextFileName('dir');
let dpath = await nextFileName('fileio_test_dir_open_sync_005');
fileio.mkdirSync(dpath);
try {
for (let i = 0; i < 1024; i++) {
......@@ -152,6 +153,7 @@ describe('fileIOTestDir', function () {
}
catch (e) {
console.log('fileio_test_dir_open_sync_006 has failed for ' + e);
expect(e.message == 'No such file or directory').assertTrue();
}
});
......@@ -164,14 +166,14 @@ describe('fileIOTestDir', function () {
let dpath = await nextFileName('fileio_test_dir_read_sync_000') + 'd'
let fpath = dpath + '/f0'
try {
expect(typeof(fileio.mkdirSync(dpath)) == 'undefined').assertTrue();
fileio.mkdirSync(dpath);
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
let dd = fileio.opendirSync(dpath);
expect(dd !== null).assertTrue();
expect(dd.readSync() !== null).assertTrue();
expect(dd.closeSync() == null).assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
expect(fileio.rmdirSync(dpath) !== null).assertTrue();
dd.closeSync();
fileio.unlinkSync(fpath);
fileio.rmdirSync(dpath);
}
catch (e) {
console.log('fileio_test_dir_read_sync_000 has failed for ' + e);
......@@ -188,10 +190,10 @@ describe('fileIOTestDir', function () {
let dpath = await nextFileName('fileio_test_dir_read_sync_001') + 'd'
let fpathArray = new Array(dpath + '/f1', dpath + '/f2', dpath + '/d3');
try {
expect(fileio.mkdirSync(dpath) !== null).assertTrue();
fileio.mkdirSync(dpath);
for (let i = 0; i < 3; i++) {
if (i == 2) {
expect(fileio.mkdirSync(fpathArray[i]) !== null).assertTrue();
fileio.mkdirSync(fpathArray[i])
} else {
expect(prepareFile(fpathArray[i], FILE_CONTENT)).assertTrue();
}
......@@ -199,23 +201,19 @@ describe('fileIOTestDir', function () {
let dd = fileio.opendirSync(dpath);
expect(dd !== null).assertTrue();
for (let i = 0; i < 3; i++) {
if (i == 2) {
let bool = typeof(dd.readSync());
expect(bool == 'object').assertTrue();
console.log('---bool=' + bool);
} else {
expect(dd.readSync() !== null).assertTrue();
}
let bool = typeof (dd.readSync());
expect(bool == 'object').assertTrue();
console.log('---bool=' + bool);
}
expect(dd.closeSync() == null).assertTrue();
dd.closeSync();
for (let i = 0; i < 3; i++) {
if (i == 2) {
expect(fileio.rmdirSync(fpathArray[i]) !== null).assertTrue();
fileio.rmdirSync(fpathArray[i]);
} else {
expect(fileio.unlinkSync(fpathArray[i]) !== null).assertTrue();
fileio.unlinkSync(fpathArray[i]);
}
}
expect(fileio.rmdirSync(dpath) !== null).assertTrue();
fileio.rmdirSync(dpath);
}
catch (e) {
console.log('fileio_test_dir_read_sync_001 has failed for ' + e);
......@@ -232,10 +230,10 @@ describe('fileIOTestDir', function () {
let dpath = await nextFileName('fileio_test_dir_read_sync_002') + 'd'
let fpathArray = new Array(dpath + '/f1', dpath + '/f2', dpath + '/d3');
try {
expect(fileio.mkdirSync(dpath) !== null).assertTrue();
fileio.mkdirSync(dpath)
for (let i = 0; i < 3; i++) {
if (i == 2) {
expect(fileio.mkdirSync(fpathArray[i]) !== null).assertTrue();
fileio.mkdirSync(fpathArray[i])
} else {
expect(prepareFile(fpathArray[i], FILE_CONTENT)).assertTrue();
}
......@@ -245,21 +243,21 @@ describe('fileIOTestDir', function () {
for (let i = 0; i < 3; i++) {
expect(dd.readSync() !== null).assertTrue();
}
expect(dd.readSync() == null).assertTrue();
expect(null).assertFail();
}
catch (e) {
console.log('fileio_test_dir_read_sync_002 has failed for ' + e);
expect(dd.closeSync() == null).assertTrue();
expect(dd.readSync() !== null).assertTrue();
dd.closeSync();
for (let i = 0; i < 3; i++) {
if (i == 2) {
expect(fileio.rmdirSync(fpathArray[i]) !== null).assertTrue();
fileio.rmdirSync(fpathArray[i]);
} else {
expect(fileio.unlinkSync(fpathArray[i]) !== null).assertTrue();
fileio.unlinkSync(fpathArray[i]);
}
}
expect(fileio.rmdirSync(dpath) !== null).assertTrue();
}
fileio.rmdirSync(dpath);
}
catch (e) {
console.log('fileio_test_dir_read_sync_002 has failed for ' + e);
expect(null).assertFail();
}
});
/**
......@@ -271,16 +269,16 @@ describe('fileIOTestDir', function () {
let dpath = await nextFileName('fileio_test_dir_read_sync_003') + 'd'
let dd;
try {
expect(fileio.mkdirSync(dpath) !== null).assertTrue();
fileio.mkdirSync(dpath);
dd = fileio.opendirSync(dpath);
expect(dd !== null).assertTrue();
expect(dd.readSync() == null).assertTrue();
expect(null).assertFail();
}
expect(dd.readSync() !== null).assertTrue();
dd.closeSync();
fileio.rmdirSync(dpath);
}
catch (e) {
expect(dd.closeSync() == null).assertTrue();
expect(fileio.rmdirSync(dpath) !== null).assertTrue();
console.log('fileio_test_dir_read_sync_003 has failed for ' + e);
expect(null).assertFail();
}
});
......@@ -294,7 +292,7 @@ describe('fileIOTestDir', function () {
let fpath = dpath + '/f1'
let dd
try {
expect(fileio.mkdirSync(dpath) !== null).assertTrue();
fileio.mkdirSync(dpath);
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
dd = fileio.opendirSync(dpath);
expect(dd !== null).assertTrue();
......@@ -302,10 +300,11 @@ describe('fileIOTestDir', function () {
expect(null).assertFail();
}
catch (e) {
expect(dd.closeSync() == null).assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
expect(fileio.rmdirSync(dpath) !== null).assertTrue();
console.log('fileio_test_dir_read_sync_004 has failed for ' + e);
expect(e.message == 'Number of arguments unmatched').assertTrue();
dd.closeSync();
fileio.unlinkSync(fpath);
fileio.rmdirSync(dpath);
}
});
......@@ -318,18 +317,18 @@ describe('fileIOTestDir', function () {
let dpath = await nextFileName('fileio_test_dir_read_sync_005') + 'd'
let fpath = dpath + '/f'
try {
expect(typeof(fileio.mkdirSync(dpath)) == 'undefined').assertTrue();
fileio.mkdirSync(dpath);
for (let i = 0; i < 10001; i++) {
expect(prepareFile(fpath + i, 'test_text')).assertTrue();
expect(prepareFile(fpath + i, 'test_text')).assertTrue();
}
let dd = fileio.opendirSync(dpath);
expect(dd !== null).assertTrue();
expect(dd.readSync() !== null).assertTrue();
expect(dd.closeSync() == null).assertTrue();
dd.closeSync();
for (let i = 0; i < 10001; i++) {
fileio.unlinkSync(fpath + i);
}
expect(fileio.rmdirSync(dpath) !== null).assertTrue();
fileio.rmdirSync(dpath);
}
catch (e) {
console.log('fileio_test_dir_read_sync_005 has failed for ' + e);
......@@ -345,15 +344,36 @@ describe('fileIOTestDir', function () {
it('fileio_test_dir_close_sync_000', 0, async function () {
let dpath = await nextFileName('fileio_test_dir_close_sync_000') + 'd'
try {
expect(fileio.mkdirSync(dpath) !== null).assertTrue();
fileio.mkdirSync(dpath);
let dd = fileio.opendirSync(dpath);
expect(dd !== null).assertTrue();
expect(dd.closeSync() == null).assertTrue();
expect(fileio.rmdirSync(dpath) !== null).assertTrue();
dd.closeSync();
fileio.rmdirSync(dpath);
}
catch (e) {
console.log('fileio_test_dir_close_sync_000 has failed for ' + e);
expect(null).assertFail();
}
});
/**
* @tc.number SUB_STORAGE_FileIO_dir_CloseSync_0100
* @tc.name fileio_test_dir_close_sync_001
* @tc.desc Function of API, closeSync. error parameter.
*/
it('fileio_test_dir_close_sync_001', 0, async function () {
let dpath = await nextFileName('fileio_test_dir_close_sync_001') + 'd'
try {
fileio.mkdirSync(dpath);
let dd = fileio.opendirSync(dpath);
expect(dd !== null).assertTrue();
dd.closeSync(-1);
expect(null).assertFail();
}
catch (e) {
console.log('fileio_test_dir_close_sync_001 has failed for ' + e);
expect(e.message == 'Dir has been closed yet').assertTrue();
fileio.rmdirSync(dpath);
}
});
});
......@@ -41,7 +41,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(stat !== null).assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_stat_sync_000 has failed for ' + e);
......@@ -62,6 +62,7 @@ describe('fileIOTestStat', function () {
}
catch (e) {
console.log('fileio_test_stat_stat_sync_001 has failed for ' + e);
expect(e.message == 'No such file or directory').assertTrue();
}
});
......@@ -72,11 +73,11 @@ describe('fileIOTestStat', function () {
*/
it('fileio_test_stat_stat_sync_002', 0, async function () {
let dpath = await nextFileName('fileio_test_stat_stat_sync_002') + 'd';
expect(fileio.mkdirSync(dpath) !== null).assertTrue();
fileio.mkdirSync(dpath);
try {
let stat = fileio.statSync(dpath);
expect(stat !== null).assertTrue();
expect(fileio.rmdirSync(dpath) !== null).assertTrue();
fileio.rmdirSync(dpath);
}
catch (e) {
console.log('fileio_test_stat_stat_sync_002 has failed for ' + e);
......@@ -118,7 +119,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.dev) == 'number').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_dev_000 has failed for ' + e);
......@@ -137,7 +138,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.ino) == 'number').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_ino_000 has failed for ' + e);
......@@ -156,7 +157,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.mode) == 'number').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_mode_000 has failed for ' + e);
......@@ -175,7 +176,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.nlink) == 'number').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_nlink_000 has failed for ' + e);
......@@ -194,7 +195,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.uid) == 'number').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_uid_000 has failed for ' + e);
......@@ -213,7 +214,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.gid) == 'number').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_gid_000 has failed for ' + e);
......@@ -232,7 +233,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.rdev) == 'number').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_rdev_000 has failed for ' + e);
......@@ -251,7 +252,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.size) == 'number').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_size_000 has failed for ' + e);
......@@ -259,25 +260,6 @@ describe('fileIOTestStat', function () {
}
});
/**
* @tc.number SUB_STORAGE_FileIO_Stat_blksize_0000
* @tc.name fileio_test_stat_blksize_000
* @tc.desc Function of API. Gets the size of the disk block containing the file.
*/
it('fileio_test_stat_blksize_000', 0, async function () {
let fpath = await nextFileName('fileio_test_stat_blksize_000');
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.blksize) == 'number').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
}
catch (e) {
console.log('fileio_test_stat_blksize_000 has failed for ' + e);
expect(null).assertFail();
}
});
/**
* @tc.number SUB_STORAGE_FileIO_Stat_blocks_0000
* @tc.name fileio_test_stat_blocks_000
......@@ -289,7 +271,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.blocks) == 'number').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_blocks_000 has failed for ' + e);
......@@ -308,7 +290,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.atime) == 'number').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_atime_000 has failed for ' + e);
......@@ -327,7 +309,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.mtime) == 'number').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_mtime_000 has failed for ' + e);
......@@ -346,7 +328,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.ctime) == 'number').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_ctime_000 has failed for ' + e);
......@@ -365,7 +347,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.isBlockDevice()) == 'boolean').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_is_block_device_000 has failed for ' + e);
......@@ -384,7 +366,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(!stat.isBlockDevice()).assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_is_block_device_001 has failed for ' + e);
......@@ -406,8 +388,9 @@ describe('fileIOTestStat', function () {
expect(null).assertFail();
}
catch (e) {
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
console.log('fileio_test_stat_is_block_device_002 has failed for ' + e);
expect(e.message == 'Number of arguments unmatched').assertTrue();
fileio.unlinkSync(fpath);
}
});
......@@ -422,7 +405,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.isCharacterDevice()) == 'boolean').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_is_character_device_000 has failed for ' + e);
......@@ -441,7 +424,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(!stat.isCharacterDevice()).assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_is_character_device_001 has failed for ' + e);
......@@ -464,7 +447,8 @@ describe('fileIOTestStat', function () {
}
catch (e) {
console.log('fileio_test_stat_is_character_device_002 has failed for ' + e);
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
expect(e.message == 'Number of arguments unmatched').assertTrue();
fileio.unlinkSync(fpath);
}
});
......@@ -479,7 +463,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.isDirectory()) == 'boolean').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_is_directory_000 has failed for ' + e);
......@@ -498,7 +482,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(!stat.isDirectory()).assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_is_directory_001 has failed for ' + e);
......@@ -514,10 +498,10 @@ describe('fileIOTestStat', function () {
it('fileio_test_stat_is_directory_002', 0, async function () {
let dpath = await nextFileName('fileio_test_stat_is_directory_002') + 'd'
try {
expect(fileio.mkdirSync(dpath) !== null).assertTrue();
fileio.mkdirSync(dpath);
let stat = fileio.statSync(dpath);
expect(stat.isDirectory()).assertTrue();
expect(fileio.rmdirSync(dpath) !== null).assertTrue();
fileio.rmdirSync(dpath);
}
catch (e) {
console.log('fileio_test_stat_is_directory_002 has failed for ' + e);
......@@ -533,14 +517,15 @@ describe('fileIOTestStat', function () {
it('fileio_test_stat_is_directory_003', 0, async function () {
let dpath = await nextFileName('fileio_test_stat_is_directory_003') + 'd'
try {
expect(fileio.mkdirSync(dpath) !== null).assertTrue();
fileio.mkdirSync(dpath);
let stat = fileio.statSync(dpath);
expect(stat.isDirectory(-1) == null).assertTrue();
expect(null).assertFail();
}
catch (e) {
console.log('fileio_test_stat_is_directory_003 has failed for ' + e);
expect(fileio.rmdirSync(dpath) !== null).assertTrue();
expect(e.message == 'Number of arguments unmatched').assertTrue();
fileio.rmdirSync(dpath);
}
});
......@@ -555,7 +540,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.isFIFO()) == 'boolean').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_is_fifo_000 has failed for ' + e);
......@@ -574,7 +559,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(!stat.isFIFO()).assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_is_fifo_001 has failed for ' + e);
......@@ -597,7 +582,8 @@ describe('fileIOTestStat', function () {
}
catch (e) {
console.log('fileio_test_stat_is_fifo_002 has failed for ' + e);
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
expect(e.message == 'Number of arguments unmatched').assertTrue();
fileio.unlinkSync(fpath);
}
});
......@@ -612,7 +598,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.isFile()) == 'boolean').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_is_file_000 has failed for ' + e);
......@@ -631,7 +617,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(stat.isFile()).assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
console.log('---fileio_test_stat_is_file_001 is passed!');
}
catch (e) {
......@@ -648,10 +634,10 @@ describe('fileIOTestStat', function () {
it('fileio_test_stat_is_file_002', 0, async function () {
let dpath = await nextFileName('fileio_test_stat_is_file_002');
try {
expect(fileio.mkdirSync(dpath) !== null).assertTrue();
fileio.mkdirSync(dpath);
let stat = fileio.statSync(dpath);
expect(!stat.isFile()).assertTrue();
expect(fileio.rmdirSync(dpath) !== null).assertTrue();
fileio.rmdirSync(dpath);
}
catch (e) {
console.log('fileio_test_stat_is_file_002 has failed for ' + e);
......@@ -667,14 +653,15 @@ describe('fileIOTestStat', function () {
it('fileio_test_stat_is_file_003', 0, async function () {
let dpath = await nextFileName('fileio_test_stat_is_file_003');
try {
expect(fileio.mkdirSync(dpath) !== null).assertTrue();
fileio.mkdirSync(dpath);
let stat = fileio.statSync(dpath);
expect(stat.isFile(-1) == null).assertTrue();
expect(null).assertFail();
}
catch (e) {
expect(fileio.rmdirSync(dpath) !== null).assertTrue();
console.log('fileio_test_stat_is_file_003 has failed for ' + e);
expect(e.message == 'Number of arguments unmatched').assertTrue();
fileio.rmdirSync(dpath);
}
});
......@@ -689,7 +676,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.isSocket()) == 'boolean').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_is_socket_000 has failed for ' + e);
......@@ -708,7 +695,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(!stat.isSocket()).assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_is_socket_001 has failed for ' + e);
......@@ -731,7 +718,8 @@ describe('fileIOTestStat', function () {
}
catch (e) {
console.log('fileio_test_stat_is_socket_002 has failed for ' + e);
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
expect(e.message == 'Number of arguments unmatched').assertTrue();
fileio.unlinkSync(fpath);
}
});
......@@ -746,7 +734,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(typeof(stat.isSymbolicLink()) == 'boolean').assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_is_symbolic_link_000 has failed for ' + e);
......@@ -765,7 +753,7 @@ describe('fileIOTestStat', function () {
try {
let stat = fileio.statSync(fpath);
expect(!stat.isSymbolicLink()).assertTrue();
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
fileio.unlinkSync(fpath);
}
catch (e) {
console.log('fileio_test_stat_is_symbolic_link_001 has failed for ' + e);
......@@ -788,7 +776,8 @@ describe('fileIOTestStat', function () {
}
catch (e) {
console.log('fileio_test_stat_is_symbolic_link_002 has failed for ' + e);
expect(fileio.unlinkSync(fpath) !== null).assertTrue();
expect(e.message == 'Number of arguments unmatched').assertTrue();
fileio.unlinkSync(fpath);
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册