diff --git a/static_core/plugins/ets/tests/ets-templates/07.expressions/16.instanceof_expression/instanceof-cte.ets b/static_core/plugins/ets/tests/ets-templates/07.expressions/16.instanceof_expression/instanceof-cte.ets new file mode 100644 index 0000000000000000000000000000000000000000..55acef85d6c3e6aef5da5cc5a5f3347622a2f79f --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/07.expressions/16.instanceof_expression/instanceof-cte.ets @@ -0,0 +1,32 @@ +/*--- +Copyright (c) 2021-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. +---*/ + +{% for case in cases %} + +/*--- +desc: CTE message on instanceof A +tags: [compile-only, negative] +---*/ + +class A { + data: T +} + +function main(): void { + let a = new A(); + assert a instanceof {{case.type}}; +} + +{% endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/07.expressions/16.instanceof_expression/instanceof-cte.params.yaml b/static_core/plugins/ets/tests/ets-templates/07.expressions/16.instanceof_expression/instanceof-cte.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1e96dde2e913c5b639890323bf36414a3d1a9376 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/07.expressions/16.instanceof_expression/instanceof-cte.params.yaml @@ -0,0 +1,19 @@ +# Copyright (c) 2021-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. + +--- +cases: + - type: 'A' + - type: '(A)' + - type: 'A < 10' + - type: 'A < 10 + 2 > 3'