1# Copyright (c) 2024 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 14ets2panda_add_gtest(ast_builder_test 15 CPP_SOURCES ast_builder_test.cpp 16) 17 18ets2panda_add_gtest(es2panda_public_test 19 CPP_SOURCES es2panda_public_test.cpp 20) 21 22ets2panda_add_gtest(ast_verifier_short_test 23 CPP_SOURCES ast_verifier_short_test.cpp 24) 25 26ets2panda_add_gtest(ast_verifier_private_protected_public_access_correct_test 27 CPP_SOURCES ast_verifier_private_protected_public_access_correct_test.cpp 28) 29 30ets2panda_add_gtest(ast_verifier_private_access_negative_test_1_4 31 CPP_SOURCES ast_verifier_private_access_negative_test_1_4.cpp 32) 33 34ets2panda_add_gtest(ast_verifier_private_access_negative_test_5_7 35 CPP_SOURCES ast_verifier_private_access_negative_test_5_7.cpp 36) 37 38ets2panda_add_gtest(ast_verifier_protected_access_correct_test 39 CPP_SOURCES ast_verifier_protected_access_correct_test.cpp 40) 41 42ets2panda_add_gtest(ast_verifier_protected_access_negative_test_1_3 43 CPP_SOURCES ast_verifier_protected_access_negative_test_1_3.cpp 44) 45 46ets2panda_add_gtest(ast_verifier_protected_access_negative_test_4_6 47 CPP_SOURCES ast_verifier_protected_access_negative_test_4_6.cpp 48) 49 50ets2panda_add_gtest(ast_verifier_reference_typeannotation_test 51 CPP_SOURCES ast_verifier_reference_typeannotation_test.cpp 52) 53 54ets2panda_add_gtest(ast_verifier_identifier_has_variable_test 55 CPP_SOURCES ast_verifier_identifier_has_variable_test.cpp 56) 57 58ets2panda_add_gtest(ast_verifier_variable_has_enclosing_scope_test 59 CPP_SOURCES ast_verifier_variable_has_enclosing_scope_test.cpp 60) 61 62ets2panda_add_gtest(ast_verifier_variable_has_scope_test 63 CPP_SOURCES ast_verifier_variable_has_scope_test.cpp 64) 65 66ets2panda_add_gtest(ast_verifier_every_child_has_valid_parent_test 67 CPP_SOURCES ast_verifier_every_child_has_valid_parent_test.cpp 68) 69 70ets2panda_add_gtest(ast_verifier_check_infinite_loop_test 71 CPP_SOURCES ast_verifier_check_infinite_loop_test.cpp 72) 73 74panda_add_library(e2p_test_plugin SHARED e2p_test_plugin.c) 75panda_target_include_directories(e2p_test_plugin PRIVATE "${ES2PANDA_PATH}") 76panda_target_link_libraries(e2p_test_plugin es2panda-public) 77 78add_custom_target(es2panda-plugin-test 79 COMMENT "Test es2panda plugin functionality" 80 COMMAND ${CMAKE_COMMAND} -E env 81 LD_LIBRARY_PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${PANDA_RUN_PREFIX} $<TARGET_FILE:es2panda> --plugins=e2p_test_plugin 82 --extension=sts "${CMAKE_CURRENT_SOURCE_DIR}/t.sts" > "${CMAKE_CURRENT_BINARY_DIR}/plugin_test.out" 83 COMMAND ${CMAKE_COMMAND} -E compare_files 84 "${CMAKE_CURRENT_BINARY_DIR}/plugin_test.out" "${CMAKE_CURRENT_SOURCE_DIR}/plugin_test.expected.txt" 85) 86 87add_dependencies(es2panda-plugin-test es2panda e2p_test_plugin) 88add_dependencies(es2panda_tests es2panda-plugin-test) 89