未验证 提交 2196f7f8 编写于 作者: O openharmony_ci 提交者: Gitee

!3480 Modify the bug that the key in plainarray is not integer

Merge pull request !3480 from wangyong/five_XTS
......@@ -533,8 +533,8 @@ describe("ArraylistTest", function () {
arrayList.removeByRange(0, 9);
let res = arrayList.length;
let res1 = arrayList.getLastIndexOf(1);
expect(res).assertEqual(1);
expect(res1).assertEqual(0);
expect(res).assertEqual(0);
expect(res1).assertEqual(-1);
});
it("SR000GGR44_testSubArrayList040", 0, function () {
let arrayList = new ArrayList();
......@@ -702,4 +702,20 @@ describe("ArraylistTest", function () {
expect(arr[i]).assertEqual(a[i]);
}
});
it("SR000GGR44_testRemoveByRange052", 0, function () {
let arrayList = new ArrayList();
arrayList.add("");
arrayList.add("");
arrayList.add(1);
arrayList.add("a");
arrayList.add(1);
arrayList.add("b");
arrayList.add("c");
arrayList.add(1);
arrayList.removeByRange(0, 8);
let res = arrayList.length;
let res1 = arrayList.getLastIndexOf(1);
expect(res).assertEqual(1);
expect(res1).assertEqual(0);
});
});
......@@ -534,7 +534,7 @@ describe("VectorTest", function () {
vector.add(14);
let arr1 = ["a", "b", "c"];
vector.copyToArray(arr1);
let a = ["a", "b", "c",4, 3, 1];
let a = ["a", "b", "c", 4, 3, 1];
for (let i = 0; i < a.length; i++) {
expect(arr1[i]).assertEqual(a[i]);
}
......
......@@ -459,7 +459,6 @@ describe("PlainArrayTest", function () {
});
it("SR000GGR45_testAdd039", 0, function () {
let plainArray = new PlainArray();
plainArray.add(1.23, "a");
plainArray.add(-2, "b");
try {
plainArray.add("a", "c");
......@@ -501,4 +500,16 @@ describe("PlainArrayTest", function () {
}
expect(flag).assertEqual(true);
});
it("SR000GGR45_testAdd042", 0, function () {
let plainArray = new PlainArray();
plainArray.add(-2, "b");
try {
plainArray.add(1.23, "a");
} catch (err) {
expect(err.name).assertEqual("TypeError");
expect(err.message).assertEqual("the index is not integer");
}
let res = plainArray.get(-2);
expect(res).assertEqual("b");
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册