diff --git a/test/moduletest/allocatearraybuffer/BUILD.gn b/test/moduletest/allocatearraybuffer/BUILD.gn index 8a192e777588da2b9eb9ba086630d414ecfdb278..50a29eb99ea9c2c3ee3c6d8b134cd49aa72a9552 100644 --- a/test/moduletest/allocatearraybuffer/BUILD.gn +++ b/test/moduletest/allocatearraybuffer/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("allocatearraybuffer") { +host_moduletest_assert_action("allocatearraybuffer") { deps = [] } diff --git a/test/moduletest/allocatearraybuffer/allocatearraybuffer.js b/test/moduletest/allocatearraybuffer/allocatearraybuffer.js index 0e5a07d549ce9fda4da7b6abe50b040f9b620123..0e5796f1e5c560a78b22c63d5aac707c779b75b4 100644 --- a/test/moduletest/allocatearraybuffer/allocatearraybuffer.js +++ b/test/moduletest/allocatearraybuffer/allocatearraybuffer.js @@ -21,7 +21,7 @@ */ var newTarget = function() {}.bind(null); var arrayBuffer = Reflect.construct(ArrayBuffer, [16], newTarget); -print(arrayBuffer.length); +assert_equal(arrayBuffer.length.toString(), "undefined"); /* * @tc.name:allocatearraybuffer @@ -31,14 +31,14 @@ print(arrayBuffer.length); */ const dataview = new DataView(new ArrayBuffer(64)); dataview.setInt16(0,-1); -print(dataview.getFloat64("cas")); +assert_equal(dataview.getFloat64("cas").toString(), "NaN"); const v32 = new Int32Array(10); for (let i = 0; i < v32.length; i++) { v32[i] = i + 1; } const v36 = this.Atomics; -print(v36.and(v32, this, v36)); +assert_equal(v36.and(v32, this, v36), 1); function SendableArrayBufferTest() { try { @@ -46,7 +46,8 @@ function SendableArrayBufferTest() { const v3 = new Proxy(SendableArrayBuffer, o1); new v3(); } catch (error) { - print(error); + assert_equal(error.toString(), "TypeError: shared ctor cannot assign unshared newTarget"); } } -SendableArrayBufferTest() \ No newline at end of file +SendableArrayBufferTest() +test_end(); \ No newline at end of file diff --git a/test/moduletest/allocatearraybuffer/expect_output.txt b/test/moduletest/allocatearraybuffer/expect_output.txt deleted file mode 100644 index 5fd9e962a359b02511ec76f82633c98d8d966fb4..0000000000000000000000000000000000000000 --- a/test/moduletest/allocatearraybuffer/expect_output.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -undefined -NaN -1 -TypeError: shared ctor cannot assign unshared newTarget \ No newline at end of file diff --git a/test/moduletest/allocatesizeoverflow/BUILD.gn b/test/moduletest/allocatesizeoverflow/BUILD.gn index bf27d97bd43450895e43dfa8e4b0e91a95d7c990..fce3db02e874e2185d8f0410c9684c47efa5152e 100644 --- a/test/moduletest/allocatesizeoverflow/BUILD.gn +++ b/test/moduletest/allocatesizeoverflow/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("allocatesizeoverflow") { +host_moduletest_assert_action("allocatesizeoverflow") { deps = [] } diff --git a/test/moduletest/allocatesizeoverflow/allocatesizeoverflow.js b/test/moduletest/allocatesizeoverflow/allocatesizeoverflow.js index 29083188bc0b10340214567bdf6b6b92252d9f07..9551fab6c464248dc24fd7e3d3c7138ff3f7a6c8 100644 --- a/test/moduletest/allocatesizeoverflow/allocatesizeoverflow.js +++ b/test/moduletest/allocatesizeoverflow/allocatesizeoverflow.js @@ -23,5 +23,6 @@ v0.length = 2465979003; try { isNaN.apply(undefined, v0); } catch (error) { - print(error); + assert_equal(error.toString(), "TypeError: len is bigger than 2^32 - 1"); } +test_end(); \ No newline at end of file diff --git a/test/moduletest/allocatesizeoverflow/expect_output.txt b/test/moduletest/allocatesizeoverflow/expect_output.txt deleted file mode 100644 index 518afaa244669fe56de958219a24f14c1aa9eae8..0000000000000000000000000000000000000000 --- a/test/moduletest/allocatesizeoverflow/expect_output.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -TypeError: len is bigger than 2^32 - 1 diff --git a/test/moduletest/arrayFindIndexCase/BUILD.gn b/test/moduletest/arrayFindIndexCase/BUILD.gn index db14fd79d8b71e7e71c672bb6f2f67a1705d1cca..67290dbbc292086a4bd48fd054d400018686386e 100644 --- a/test/moduletest/arrayFindIndexCase/BUILD.gn +++ b/test/moduletest/arrayFindIndexCase/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("findIndex") { +host_moduletest_assert_action("findIndex") { deps = [] } diff --git a/test/moduletest/arrayFindIndexCase/expect_output.txt b/test/moduletest/arrayFindIndexCase/expect_output.txt deleted file mode 100644 index 390336e3c3e6124def65864ce86d972240e8cbc3..0000000000000000000000000000000000000000 --- a/test/moduletest/arrayFindIndexCase/expect_output.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -3 -1 -1 --1 -2 --1 -2 -0 \ No newline at end of file diff --git a/test/moduletest/arrayFindIndexCase/findIndex.js b/test/moduletest/arrayFindIndexCase/findIndex.js index 561459622dc10a5c750a1ef37853c90c78813656..96dc4d3f23bc71283d4386972c3fd7e5bd4df441 100644 --- a/test/moduletest/arrayFindIndexCase/findIndex.js +++ b/test/moduletest/arrayFindIndexCase/findIndex.js @@ -22,7 +22,7 @@ const array1 = [5, 12, 8, 130, 44]; const isLargeNumber = (element) => element > 13; -print(array1.findIndex(isLargeNumber)); +assert_equal(array1.findIndex(isLargeNumber), 3); const arrayLike = { length: 3, @@ -30,8 +30,8 @@ const arrayLike = { 1: 7.3, 2: 4, }; -print(Array.prototype.findIndex.call(arrayLike, (x) => !Number.isInteger(x))); -print([1, , 3].findIndex((x) => x === undefined)); +assert_equal(Array.prototype.findIndex.call(arrayLike, (x) => !Number.isInteger(x)), 1); +assert_equal([1, , 3].findIndex((x) => x === undefined), 1); function isPrime(element) { if (element % 2 === 0 || element < 2) { return false; @@ -43,16 +43,16 @@ function isPrime(element) { } return true; } -print([4, 6, 8, 9, 12].findIndex(isPrime)); -print([4, 6, 7, 9, 12].findIndex(isPrime)); +assert_equal([4, 6, 8, 9, 12].findIndex(isPrime), -1); +assert_equal([4, 6, 7, 9, 12].findIndex(isPrime), 2); const words = ["spray", "limit", "limits"]; const deleteWords = words.findIndex((word, index, arr) => { arr.length=2 return word == "limits" }); -print(deleteWords); -print(words.length); +assert_equal(deleteWords, -1); +assert_equal(words.length, 2); var array = ["first", "second"]; Object.defineProperty(array, 0, { @@ -62,4 +62,5 @@ Object.defineProperty(array, 0, { } }); const hasFirst = (element) => element == "first"; -print(array.findIndex(hasFirst)); +assert_equal(array.findIndex(hasFirst), 0); +test_end(); diff --git a/test/moduletest/arrayPopCase/BUILD.gn b/test/moduletest/arrayPopCase/BUILD.gn index 74641419658ce116b136f42f2281d1ce21272ba3..77176bfeb8037cb2810ecb2b5f8e9c69abce528a 100644 --- a/test/moduletest/arrayPopCase/BUILD.gn +++ b/test/moduletest/arrayPopCase/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("arrayPopCase") { +host_moduletest_assert_action("arrayPopCase") { deps = [] } diff --git a/test/moduletest/arrayPopCase/arrayPopCase.js b/test/moduletest/arrayPopCase/arrayPopCase.js index eeb81a39fedc8c72887ef8f86c120b4cc6fcbbbc..b69d6238540adc64c17627b7c4acdc85505ad3b1 100644 --- a/test/moduletest/arrayPopCase/arrayPopCase.js +++ b/test/moduletest/arrayPopCase/arrayPopCase.js @@ -22,13 +22,15 @@ const plants = ['broccoli', 'cauliflower', 'cabbage', 'kale', 'tomato']; -print(plants.pop()); +assert_equal(plants.pop().toString(), "toma"); // Expected output: "tomato" -print(plants); +assert_equal(plants.toString(), "broccoli,cauliflower,cabbage,kale"); // Expected output: Array ["broccoli", "cauliflower", "cabbage", "kale"] plants.pop(); -print(plants); +assert_equal(plants.toString(), "broccoli,cauliflower,cabbage"); // Expected output: Array ["broccoli", "cauliflower", "cabbage"] + +test_end(); diff --git a/test/moduletest/arrayPopCase/expect_output.txt b/test/moduletest/arrayPopCase/expect_output.txt deleted file mode 100644 index 99d78e677e91eeaf39affad0d92192d6a1e006a6..0000000000000000000000000000000000000000 --- a/test/moduletest/arrayPopCase/expect_output.txt +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -tomato -broccoli,cauliflower,cabbage,kale -broccoli,cauliflower,cabbage diff --git a/test/moduletest/arrayconstructor/BUILD.gn b/test/moduletest/arrayconstructor/BUILD.gn index 181d7c860b15d7ee4810f7f90836abd92cc06aa3..efaa1c9acc75de8fc2a23f5e6450a6631a7fb4f5 100644 --- a/test/moduletest/arrayconstructor/BUILD.gn +++ b/test/moduletest/arrayconstructor/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("arrayconstructor") { +host_moduletest_assert_action("arrayconstructor") { deps = [] } diff --git a/test/moduletest/arrayconstructor/arrayconstructor.js b/test/moduletest/arrayconstructor/arrayconstructor.js index f0757d1afa782436b3591439b081affcb37e263d..27d23aae33ad2ae7f065268bdd24700cb0efbcac 100644 --- a/test/moduletest/arrayconstructor/arrayconstructor.js +++ b/test/moduletest/arrayconstructor/arrayconstructor.js @@ -20,50 +20,51 @@ function testSpeciesEffect() { custom.constructor = CustomArray; print("Testing methods affected by constructor:"); - + // Array.prototype.concat let result = custom.concat([4, 5]); - print("concat:", result instanceof CustomArray); // true + assert_equal(result instanceof CustomArray, true); // true // Array.prototype.map result = custom.map(x => x * 2); - print("map:", result instanceof CustomArray); // true + assert_equal(result instanceof CustomArray, true); // true // Array.prototype.filter result = custom.filter(x => x > 1); - print("filter:", result instanceof CustomArray); // true + assert_equal(result instanceof CustomArray, true); // true // Array.prototype.slice result = custom.slice(1); - print("slice:", result instanceof CustomArray); // true + assert_equal(result instanceof CustomArray, true); // true // Array.prototype.flatMap result = custom.flatMap(x => [x, x * 2]); - print("flatMap:", result instanceof CustomArray); // true + assert_equal(result instanceof CustomArray, true); // true // Array.prototype.flat result = custom.flat(); - print("flat:", result instanceof CustomArray); // true + assert_equal(result instanceof CustomArray, true); // true // Array.prototype.splice result = custom.splice(1,2,3); - print("splice:", result instanceof CustomArray); // true + assert_equal(result instanceof CustomArray, true); // true // Array.prototype.toReversed result = custom.toReversed(); - print("toReversed:", result instanceof Array); // true + assert_equal(result instanceof Array, true); // true // Array.prototype.toSorted result = custom.toSorted(); - print("toSorted:", result instanceof Array); // true + assert_equal(result instanceof Array, true); // true // Array.prototype.toSpliced result = custom.toSpliced(0,1); - print("toSpliced:", result instanceof Array); // true + assert_equal(result instanceof Array, true); // true // Array.prototype.toSpliced result = custom.with(0,1); - print("with:", result instanceof Array); // true + assert_equal(result instanceof Array, true); // true } testSpeciesEffect() +test_end(); diff --git a/test/moduletest/arrayconstructor/expect_output.txt b/test/moduletest/arrayconstructor/expect_output.txt deleted file mode 100644 index 1d812d0d70112c67daea25f328d12cdb1e1de779..0000000000000000000000000000000000000000 --- a/test/moduletest/arrayconstructor/expect_output.txt +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -Testing methods affected by constructor: -concat: true -map: true -filter: true -slice: true -flatMap: true -flat: true -splice: true -toReversed: true -toSorted: true -toSpliced: true -with: true diff --git a/test/moduletest/arrayderived/BUILD.gn b/test/moduletest/arrayderived/BUILD.gn index 185dab893841209d30eec420e59deb20f34ee25f..c684252f48c76192039ae410da73ddc37bd8357c 100755 --- a/test/moduletest/arrayderived/BUILD.gn +++ b/test/moduletest/arrayderived/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("arrayderived") { +host_moduletest_assert_action("arrayderived") { deps = [] } diff --git a/test/moduletest/arrayderived/arrayderived.js b/test/moduletest/arrayderived/arrayderived.js index d2a344cee6a8c02edc2347d2e0a0b167305b6f1d..cf7b854e5edcc6a2744d192807044f99eb3b6b4f 100755 --- a/test/moduletest/arrayderived/arrayderived.js +++ b/test/moduletest/arrayderived/arrayderived.js @@ -23,27 +23,27 @@ function testConstructorEffect() { // Array.prototype.concat let result = custom.concat([4, 5]); - print("concat:", result instanceof CustomArray); // true + assert_equal(result instanceof CustomArray, true); // true // Array.prototype.map result = custom.map(x => x * 2); - print("map:", result instanceof CustomArray); // true + assert_equal(result instanceof CustomArray, true); // true // Array.prototype.filter result = custom.filter(x => x > 1); - print("filter:", result instanceof CustomArray); // true + assert_equal(result instanceof CustomArray, true); // true // Array.prototype.slice result = custom.slice(1); - print("slice:", result instanceof CustomArray); // true + assert_equal(result instanceof CustomArray, true); // true // Array.prototype.flatMap result = custom.flatMap(x => [x, x * 2]); - print("flatMap:", result instanceof CustomArray); // true + assert_equal(result instanceof CustomArray, true); // true // Array.prototype.flat result = custom.flat(); - print("flat:", result instanceof CustomArray); // true + assert_equal(result instanceof CustomArray, true); // true } @@ -57,9 +57,11 @@ function testArrayprototypechange() { }) Array.prototype.__proto__ = newProto; let a = new Array(10); - print(a[1]); + assert_equal(a[1], 1); } testConstructorEffect() -testArrayprototypechange() \ No newline at end of file +testArrayprototypechange() + +test_end(); \ No newline at end of file diff --git a/test/moduletest/arrayderived/expect_output.txt b/test/moduletest/arrayderived/expect_output.txt deleted file mode 100755 index bc4856fe588cfa1f9d2da30c2bb945e17bd370f6..0000000000000000000000000000000000000000 --- a/test/moduletest/arrayderived/expect_output.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -Testing methods affected by constructor: -concat: true -map: true -filter: true -slice: true -flatMap: true -flat: true -Testing array when Array's prototype changed. -1 \ No newline at end of file diff --git a/test/moduletest/arrayfillproto/BUILD.gn b/test/moduletest/arrayfillproto/BUILD.gn index 3d93459c01a7a86fdd7f90f280b93b541d0c9ff3..306ebd16d827866dccbba98e7ab11242fe10fffa 100644 --- a/test/moduletest/arrayfillproto/BUILD.gn +++ b/test/moduletest/arrayfillproto/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("arrayfillproto") { +host_moduletest_assert_action("arrayfillproto") { deps = [] } diff --git a/test/moduletest/arrayfillproto/arrayfillproto.js b/test/moduletest/arrayfillproto/arrayfillproto.js index 78170888ce10919c764334bdea5a155aaf23de49..a07677692d13932c3deee2a92e76bd5495b20090 100644 --- a/test/moduletest/arrayfillproto/arrayfillproto.js +++ b/test/moduletest/arrayfillproto/arrayfillproto.js @@ -23,4 +23,11 @@ arr1.__proto__.length = 10; arr1.__proto__.fill(233, 0, 7); let arr2 = new Array(500); let arr3 = arr1.concat(arr2); -print(arr3[0], arr3[1], arr3[2], arr3[500], arr3[501], arr3[502]); \ No newline at end of file +assert_equal(arr3[0], 233); +assert_equal(arr3[1], 233); +assert_equal(arr3[2], 233); +assert_equal(arr3[500], 233); +assert_equal(arr3[501], 233); +assert_equal(arr3[502], 233); + +test_end(); \ No newline at end of file diff --git a/test/moduletest/arrayfillproto/expect_output.txt b/test/moduletest/arrayfillproto/expect_output.txt deleted file mode 100644 index 6b22c2372cff2098a01fd080fbb516ff3c652f25..0000000000000000000000000000000000000000 --- a/test/moduletest/arrayfillproto/expect_output.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -233 233 233 233 233 233 \ No newline at end of file diff --git a/test/moduletest/arrayfindlastindex/BUILD.gn b/test/moduletest/arrayfindlastindex/BUILD.gn index 5415623086071d01a048ea9915bd3b69402bd9cd..31d93e0034c541765640989a00d01ba7c8f115aa 100644 --- a/test/moduletest/arrayfindlastindex/BUILD.gn +++ b/test/moduletest/arrayfindlastindex/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("arrayfindlastindex") { +host_moduletest_assert_action("arrayfindlastindex") { deps = [] } diff --git a/test/moduletest/arrayfindlastindex/arrayfindlastindex.js b/test/moduletest/arrayfindlastindex/arrayfindlastindex.js index 7ff2f8c0f4a14fc55487f603c3f8ea38d289cbfb..61a5d1053bf7d44437cc9b1b45463161d54a5129 100644 --- a/test/moduletest/arrayfindlastindex/arrayfindlastindex.js +++ b/test/moduletest/arrayfindlastindex/arrayfindlastindex.js @@ -25,7 +25,7 @@ var index = a.findLastIndex(function(val){ return val === undefined; }); - print(index); + assert_equal(index, 2); })(); var arr1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; @@ -39,9 +39,9 @@ function testFunction(element, index, array) { for (let i = 0; i < 10; i++) arr2[i] = i; var result1 = arr1.findLastIndex(testFunction); -print(result1); +assert_equal(result1, 0); var result2 = arr2.findLastIndex(testFunction); -print(result2); +assert_equal(result2, 0); let arr3 = [1, 2, , 7, , undefined]; arr3.__proto__.push(9); @@ -50,7 +50,7 @@ arr3.__proto__.push(9); function fun1(element) { return element === 1; } -print(arr3.findLastIndex(fun1)); +assert_equal(arr3.findLastIndex(fun1), 0); arr3.__proto__.pop(9); arr3.__proto__.pop(9); arr3.__proto__.pop(9); @@ -60,7 +60,7 @@ let arr4 = [1, 2, 3, 4, 5, 6, 7, 8]; function func2(element, index, arr) { return element === 6; } -print(arr4.findLastIndex(func2)); +assert_equal(arr4.findLastIndex(func2), 5); //notFound let arr5 = new Array(5, 2, 7, 9, 20); @@ -68,4 +68,5 @@ function func3(element, index, arr) { arr.length = 3; return element === 100; } -print(arr5.findLastIndex(func3)); \ No newline at end of file +assert_equal(arr5.findLastIndex(func3), -1); +test_end(); \ No newline at end of file diff --git a/test/moduletest/arrayfindlastindex/expect_output.txt b/test/moduletest/arrayfindlastindex/expect_output.txt deleted file mode 100644 index 10dfc456202fa0677aef869f3a28aecc1a50beb3..0000000000000000000000000000000000000000 --- a/test/moduletest/arrayfindlastindex/expect_output.txt +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -2 -0 -0 -0 -5 --1 diff --git a/test/moduletest/arrayflat/BUILD.gn b/test/moduletest/arrayflat/BUILD.gn index 504879ce7205f67ac36b4b4b49c04b4e4a9d4c48..fe3b8c6a05c9b34cf2bf5e844c71a5674414667d 100644 --- a/test/moduletest/arrayflat/BUILD.gn +++ b/test/moduletest/arrayflat/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("arrayflat") { +host_moduletest_assert_action("arrayflat") { deps = [] } diff --git a/test/moduletest/arrayflat/arrayflat.js b/test/moduletest/arrayflat/arrayflat.js index 041653e738e0b2055873bf9af9d0689016bc98ba..9f90bf01938bdd42b6b637171203760448b267fb 100644 --- a/test/moduletest/arrayflat/arrayflat.js +++ b/test/moduletest/arrayflat/arrayflat.js @@ -20,7 +20,7 @@ * @tc.require: issueI5NO8G issueI8FBM3 */ const input = [1, [2], [[3]]]; -print(input.flat(undefined)); +assert_equal(input.flat(undefined).toString(), "1,2,3"); { class MyArray extends Array { @@ -30,5 +30,6 @@ print(input.flat(undefined)); } const wannabe = new MyArray(); const flattened = wannabe.flat(Infinity); - print(flattened instanceof MyArray); -} \ No newline at end of file + assert_equal(flattened instanceof MyArray, true); +} +test_end(); \ No newline at end of file diff --git a/test/moduletest/arrayprotochange/BUILD.gn b/test/moduletest/arrayprotochange/BUILD.gn index 68f61dffc24ab4b2c10e5ca41a652cf0e79f4c70..1b38b77e85d97b38a9650db8fbd76d363c5222e1 100755 --- a/test/moduletest/arrayprotochange/BUILD.gn +++ b/test/moduletest/arrayprotochange/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("arrayprotochange") { +host_moduletest_assert_action("arrayprotochange") { deps = [] } diff --git a/test/moduletest/arrayprotochange/arrayprotochange.js b/test/moduletest/arrayprotochange/arrayprotochange.js index 01e695fd51705af2d7c1bcd3dccee8bd92ae6932..008499224019d1bd71dcee2a93ab3cff255df0f3 100644 --- a/test/moduletest/arrayprotochange/arrayprotochange.js +++ b/test/moduletest/arrayprotochange/arrayprotochange.js @@ -23,5 +23,7 @@ var arr = [0, 1, 2, 3, 4]; var arr2 = [0, , , 3, 4]; arr2.__proto__ = arr; -print(arr2[1]); -print(arr2.at(1)); \ No newline at end of file +assert_equal(arr2[1], 1); +assert_equal(arr2.at(1), 1); + +test_end(); \ No newline at end of file diff --git a/test/moduletest/arrayprotochange/expect_output.txt b/test/moduletest/arrayprotochange/expect_output.txt deleted file mode 100755 index a45895c8a7a1ae7490f767d88adbaf9667ba5130..0000000000000000000000000000000000000000 --- a/test/moduletest/arrayprotochange/expect_output.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -1 -1 diff --git a/test/moduletest/arraypushproto/BUILD.gn b/test/moduletest/arraypushproto/BUILD.gn index 40d37db4668d2b1cf15d956c8d0e52a2685295ab..8c7e1ab477c2e7d66352b7ab3aa51ec1b4e52f33 100644 --- a/test/moduletest/arraypushproto/BUILD.gn +++ b/test/moduletest/arraypushproto/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("arraypushproto") { +host_moduletest_assert_action("arraypushproto") { deps = [] } diff --git a/test/moduletest/arraypushproto/arraypushproto.js b/test/moduletest/arraypushproto/arraypushproto.js index 141116edf12382de7b1c59ebe6c29a1f21c45467..a049e1e5c861d64fcb30559a3ef5afa60d6e57f4 100644 --- a/test/moduletest/arraypushproto/arraypushproto.js +++ b/test/moduletest/arraypushproto/arraypushproto.js @@ -22,4 +22,7 @@ let arr1 = new Array(500); arr1.__proto__.push(1); let arr2 = new Array(500); let arr3 = arr1.concat(arr2); -print(arr3[0], arr3[500]); \ No newline at end of file +assert_equal(arr3[0], 1); +assert_equal(arr3[500], 1); + +test_end(); \ No newline at end of file diff --git a/test/moduletest/arraypushproto/expect_output.txt b/test/moduletest/arraypushproto/expect_output.txt deleted file mode 100644 index 8bbcbbbc7dbe3285db1ea4d8d85d25e1c8d29183..0000000000000000000000000000000000000000 --- a/test/moduletest/arraypushproto/expect_output.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -1 1 \ No newline at end of file diff --git a/test/moduletest/arrayslice/BUILD.gn b/test/moduletest/arrayslice/BUILD.gn index 94bd687aafecf5ecd9ae96fb290e990e4f4a9618..90495512efaac407f88a910564115c72fa8b7010 100644 --- a/test/moduletest/arrayslice/BUILD.gn +++ b/test/moduletest/arrayslice/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("arrayslice") { +host_moduletest_assert_action("arrayslice") { deps = [] } diff --git a/test/moduletest/arrayslice/arrayslice.js b/test/moduletest/arrayslice/arrayslice.js index b4eb9191b5b460ccdbccc541471d29bcd180821d..e0258b851b381122984a5d792eb79c3e5e084e4a 100644 --- a/test/moduletest/arrayslice/arrayslice.js +++ b/test/moduletest/arrayslice/arrayslice.js @@ -27,12 +27,12 @@ Array.prototype.slice.apply(arr, [2, length]); arr.splice(length, 2, 127, undefined, 127, undefined); } - print(arr.length); + assert_equal(arr.length, 4); } var holey_array = [1, 2, 3, 4, 5,,,,,,]; -print(holey_array.slice(6, 7)[0]); -print(holey_array.slice(2, 3)[0]); +assert_equal(holey_array.slice(6, 7)[0].toString(), "undefined"); +assert_equal(holey_array.slice(2, 3)[0], 3); (function() { var array = [,]; @@ -41,7 +41,7 @@ print(holey_array.slice(2, 3)[0]); } array.__proto__.push(5); var narr = slice(); - print(Object.getOwnPropertyDescriptor(narr, 0)); + assert_equal(Object.getOwnPropertyDescriptor(narr, 0).toString(), "[object Object]"); })(); @@ -67,4 +67,5 @@ function f0() { v7.bind(); } runNearStackLimit(f0); -print("runNearStackLimit test success!"); \ No newline at end of file +print("runNearStackLimit test success!"); +test_end(); \ No newline at end of file diff --git a/test/moduletest/arrayslice/expect_output.txt b/test/moduletest/arrayslice/expect_output.txt deleted file mode 100644 index 062f2a8f643cbe2f75c1e1ae66eb866d1cd93592..0000000000000000000000000000000000000000 --- a/test/moduletest/arrayslice/expect_output.txt +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -4 -undefined -3 -[object Object] -runNearStackLimit test success!