From 86d6f4422f57ef0691f202d891190f94fa52a0e3 Mon Sep 17 00:00:00 2001 From: ignatenkooleg Date: Thu, 11 Sep 2025 23:31:22 +0300 Subject: [PATCH] 7.11 add complex tests with many parameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/ICXMDW Testing: all pre-merge tests passed, logs available in ggWatcher Signed-off-by: ignatenkooleg --- .../fcall_many_params.ets | 78 +++++++++++++++++++ .../fcall_many_params.params.yaml | 35 +++++++++ 2 files changed, 113 insertions(+) create mode 100644 static_core/plugins/ets/tests/ets-templates/07.expressions/11.function_call_expression/fcall_many_params.ets create mode 100644 static_core/plugins/ets/tests/ets-templates/07.expressions/11.function_call_expression/fcall_many_params.params.yaml diff --git a/static_core/plugins/ets/tests/ets-templates/07.expressions/11.function_call_expression/fcall_many_params.ets b/static_core/plugins/ets/tests/ets-templates/07.expressions/11.function_call_expression/fcall_many_params.ets new file mode 100644 index 0000000000..76a467487f --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/07.expressions/11.function_call_expression/fcall_many_params.ets @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2025 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. + */ + +{%- for c in cases %} +/*--- +desc: >- + A function call expression is used to call a function or a lambda expression. + Test calls with many parameters. +---*/ + + +let q: boolean|undefined + +function foo({{c.decl}} lambda1?: () => void, lambda2?: () => void): boolean { + return lambda2 == undefined +} + +function test_function() { + arktest.assertTrue(foo({{c.use}} q ? undefined : ()=>{}, undefined)) +} + +function test_lambda() { + let test_lambda = ({{c.decl}} lambda1?: () => void, lambda2?: () => void) => { return lambda2 == undefined; } + arktest.assertTrue(test_lambda({{c.use}} q ? undefined : ()=>{}, undefined)) +} + +class A { + foo({{c.decl}} lambda1?: () => void, lambda2?: () => void): boolean { + return lambda2 == undefined + } +} + +function test_method() { + arktest.assertTrue(new A().foo({{c.use}} q ? undefined : ()=>{}, undefined)) +} + +class B { + static foo({{c.decl}} lambda1?: () => void, lambda2?: () => void): boolean { + return lambda2 == undefined + } +} + +function test_static_method() { + arktest.assertTrue(B.foo({{c.use}} q ? undefined : ()=>{}, undefined)) +} + +class C { + result: boolean + + constructor({{c.decl}} lambda1?: () => void, lambda2?: () => void) { + this.result = lambda2 == undefined + } +} + +function test_constructor() { + arktest.assertTrue(new C({{c.use}} q ? undefined : ()=>{}, undefined).result) +} + +function main() { + test_function() + test_lambda() + test_method() + test_static_method() + test_constructor() +} +{%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/07.expressions/11.function_call_expression/fcall_many_params.params.yaml b/static_core/plugins/ets/tests/ets-templates/07.expressions/11.function_call_expression/fcall_many_params.params.yaml new file mode 100644 index 0000000000..1c58cd3609 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/07.expressions/11.function_call_expression/fcall_many_params.params.yaml @@ -0,0 +1,35 @@ +# Copyright (c) 2025 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. + +--- +cases: + - decl: "k1: string, k2: string," + use: '"1", "2",' + + - decl: "k1: string, k2: string, k3: string," + use: '"1", "2", "3",' + + - decl: "k1: string, k2: string, k3: string, k4: string," + use: '"1", "2", "3", "4",' + + - decl: "k1: string, k2: string, k3: string, k4: string, k5: string," + use: '"1", "2", "3", "4", "5",' + + - decl: "k1: string, k2: string, k3: string, k4: string, k5: string, k6: string," + use: '"1", "2", "3", "4", "5", "6",' + + - decl: "k1: string, k2: string, k3: string, k4: string, k5: string, k6: string, k7: string," + use: '"1", "2", "3", "4", "5", "6", "7",' + + - decl: "k1: string, k2: string, k3: string, k4: string, k5: string, k6: string, k7: string, k8: string," + use: '"1", "2", "3", "4", "5", "6", "7", "8",' -- Gitee