• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2025 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14function(add_test project)
15    set(PROJECT_TARGET_NAME es2panda-tsconfig-test-decl-${project})
16    set(ETS_CONFIG_DECL ${CMAKE_CURRENT_BINARY_DIR}/${project}/arktsconfig_decl.json)
17    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${project}/arktsconfig.in.decl.json ${ETS_CONFIG_DECL})
18    add_custom_target(${PROJECT_TARGET_NAME}
19        COMMENT "Testing tsconfig for: ${project}"
20        DEPENDS es2panda
21        WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
22        COMMAND python3 test.py
23            --es2panda '${PANDA_RUN_PREFIX} $<TARGET_FILE:es2panda>'
24            --arktsconfig ${CMAKE_CURRENT_BINARY_DIR}/${project}/arktsconfig_decl.json
25            --stdlib ${PANDA_ROOT}/plugins/ets/stdlib
26            --target ${project}/main.ets
27    )
28    add_dependencies(es2panda_tests ${PROJECT_TARGET_NAME})
29endfunction()
30
31add_test(resolve-dynamic-paths)
32add_test(check-decl-path)
33add_test(check-export-decl)
34add_test(check-extend-dynamic)
35add_test(typecheck-decl)