提交 9b50f3e2 编写于 作者: B buzhuyu

modify taskpool xts throw error information

description:modify taskpool xts throw error information

issue:https://gitee.com/openharmony/commonlibrary_ets_utils/issues/I7IYGPSigned-off-by: Nbuzhuyu <buzhuyu@huawei.com>
上级 9efe6e89
...@@ -1173,12 +1173,25 @@ describe('ActsAbilityTest', function () { ...@@ -1173,12 +1173,25 @@ describe('ActsAbilityTest', function () {
it('TaskPoolTestClass056', 0, async function (done) { it('TaskPoolTestClass056', 0, async function (done) {
function inspectStatus(arg) { function inspectStatus(arg) {
"use concurrent" "use concurrent"
let start = new Date().getTime();
while (new Date().getTime() - start < 1000) {
continue;
}
return arg; return arg;
} }
let task = new taskpool.Task(inspectStatus, 100); let task1 = new taskpool.Task(inspectStatus, 100);
taskpool.execute(task); let task2 = new taskpool.Task(inspectStatus, 200);
taskpool.cancel(task); let task3 = new taskpool.Task(inspectStatus, 300);
let task4 = new taskpool.Task(inspectStatus, 400);
taskpool.execute(task1);
taskpool.execute(task2);
taskpool.execute(task3);
taskpool.execute(task4);
setTimeout(()=>{
taskpool.cancel(task4);}, 500);
expect(taskpool.Task.isCanceled() == false); expect(taskpool.Task.isCanceled() == false);
done(); done();
}) })
...@@ -1214,8 +1227,7 @@ describe('ActsAbilityTest', function () { ...@@ -1214,8 +1227,7 @@ describe('ActsAbilityTest', function () {
taskpool.execute(task1); taskpool.execute(task1);
taskpool.cancel(task1); taskpool.cancel(task1);
} catch(e) { } catch(e) {
expect(e.toString()).assertEqual( expect(e.toString()).assertEqual("BusinessError: The task does not exist when it is canceled");
"BusinessError: The task does not exist when it is canceled, taskpool:: can not find the task");
} }
expect(taskpool.Task.isCanceled() == false); expect(taskpool.Task.isCanceled() == false);
done(); done();
...@@ -1251,8 +1263,7 @@ describe('ActsAbilityTest', function () { ...@@ -1251,8 +1263,7 @@ describe('ActsAbilityTest', function () {
taskpool.cancel(task1); taskpool.cancel(task1);
} }
catch (e) { catch (e) {
expect(e.toString()).assertEqual( expect(e.toString()).assertEqual("BusinessError: The task does not exist when it is canceled");
"BusinessError: The task does not exist when it is canceled, taskpool:: can not find the task");
} }
done(); done();
}) })
...@@ -1281,8 +1292,7 @@ describe('ActsAbilityTest', function () { ...@@ -1281,8 +1292,7 @@ describe('ActsAbilityTest', function () {
taskpool.cancel(task3); taskpool.cancel(task3);
} }
catch (e) { catch (e) {
expect(e.toString()).assertEqual( expect(e.toString()).assertEqual("BusinessError: The task does not exist when it is canceled");
"BusinessError: The task does not exist when it is canceled, taskpool:: can not find the task");
} }
done(); done();
}) })
...@@ -1326,8 +1336,7 @@ describe('ActsAbilityTest', function () { ...@@ -1326,8 +1336,7 @@ describe('ActsAbilityTest', function () {
taskpool.cancel(task3); taskpool.cancel(task3);
} }
catch (e) { catch (e) {
expect(e.toString()).assertEqual( expect(e.toString()).assertEqual("BusinessError: The task does not exist when it is canceled");
"BusinessError: The task does not exist when it is canceled, taskpool:: can not find the task");
} }
done(); done();
}) })
...@@ -1372,8 +1381,7 @@ describe('ActsAbilityTest', function () { ...@@ -1372,8 +1381,7 @@ describe('ActsAbilityTest', function () {
taskpool.cancel(task2); taskpool.cancel(task2);
} }
catch (e) { catch (e) {
expect(e.toString()).assertEqual( expect(e.toString()).assertEqual("BusinessError: The task does not exist when it is canceled");
"BusinessError: The task does not exist when it is canceled, taskpool:: can not find the task");
} }
done(); done();
}) })
...@@ -1472,8 +1480,7 @@ describe('ActsAbilityTest', function () { ...@@ -1472,8 +1480,7 @@ describe('ActsAbilityTest', function () {
taskpool.cancel(taskGroup); taskpool.cancel(taskGroup);
} catch (e) { } catch (e) {
expect(e.toString()).assertEqual( expect(e.toString()).assertEqual("BusinessError: The task group does not exist when it is canceled");
"BusinessError: The task group does not exist when it is canceled, taskpool:: can not find the taskGroup");
} }
done(); done();
}) })
...@@ -1513,8 +1520,7 @@ describe('ActsAbilityTest', function () { ...@@ -1513,8 +1520,7 @@ describe('ActsAbilityTest', function () {
try { try {
taskpool.cancel(taskGroup1); taskpool.cancel(taskGroup1);
} catch (e) { } catch (e) {
expect(e.toString()).assertEqual( expect(e.toString()).assertEqual("BusinessError: The task group does not exist when it is canceled");
"BusinessError: The task group does not exist when it is canceled, taskpool:: can not find the taskGroup");
} }
}, 3000); }, 3000);
done(); done();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册