diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 2e6a3d84..39f39b48 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -58,15 +58,9 @@ if (BUILD_TESTING) find_package(GTest CONFIG REQUIRED) set(googleapis_functions_framework_examples_unit_tests # cmake-format: sort - cloud_event_examples_test.cc http_examples_test.cc - http_integration_test.cc http_unit_test.cc site_test.cc) + cloud_event_examples_test.cc http_examples_test.cc site_test.cc) - set(googleapis_functions_framework_examples_programs - # cmake-format: sort - http_integration_server.cc) - - foreach (fname ${googleapis_functions_framework_examples_unit_tests} - ${googleapis_functions_framework_examples_programs}) + foreach (fname ${googleapis_functions_framework_examples_unit_tests}) string(REPLACE "/" "_" target "${fname}") string(REPLACE ".cc" "" target "${target}") add_executable("${target}" ${fname}) @@ -75,11 +69,8 @@ if (BUILD_TESTING) PRIVATE functions_framework_examples googleapis_functions_framework Boost::filesystem GTest::gmock_main GTest::gmock GTest::gtest) - endforeach () - - foreach (fname ${googleapis_functions_framework_examples_unit_tests}) - string(REPLACE "/" "_" target "${fname}") - string(REPLACE ".cc" "" target "${target}") add_test(NAME ${target} COMMAND ${target}) endforeach () endif () + +add_subdirectory(site/testing_http) diff --git a/examples/site/testing_http/CMakeLists.txt b/examples/site/testing_http/CMakeLists.txt new file mode 100644 index 00000000..ea91fd51 --- /dev/null +++ b/examples/site/testing_http/CMakeLists.txt @@ -0,0 +1,44 @@ +# ~~~ +# Copyright 2020 Google LLC +# +# 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. +# ~~~ + +if (BUILD_TESTING) + find_package(GTest CONFIG REQUIRED) + set(googleapis_functions_framework_examples_unit_tests + # cmake-format: sort + http_integration_test.cc http_unit_test.cc) + + set(googleapis_functions_framework_examples_programs + # cmake-format: sort + http_integration_server.cc) + + foreach (fname ${googleapis_functions_framework_examples_unit_tests} + ${googleapis_functions_framework_examples_programs}) + string(REPLACE "/" "_" target "${fname}") + string(REPLACE ".cc" "" target "${target}") + add_executable("${target}" ${fname}) + target_link_libraries( + ${target} + PRIVATE functions_framework_examples googleapis_functions_framework + Boost::filesystem GTest::gmock_main GTest::gmock + GTest::gtest) + endforeach () + + foreach (fname ${googleapis_functions_framework_examples_unit_tests}) + string(REPLACE "/" "_" target "${fname}") + string(REPLACE ".cc" "" target "${target}") + add_test(NAME ${target} COMMAND ${target}) + endforeach () +endif () diff --git a/examples/http_integration_server.cc b/examples/site/testing_http/http_integration_server.cc similarity index 100% rename from examples/http_integration_server.cc rename to examples/site/testing_http/http_integration_server.cc diff --git a/examples/http_integration_test.cc b/examples/site/testing_http/http_integration_test.cc similarity index 100% rename from examples/http_integration_test.cc rename to examples/site/testing_http/http_integration_test.cc diff --git a/examples/http_unit_test.cc b/examples/site/testing_http/http_unit_test.cc similarity index 100% rename from examples/http_unit_test.cc rename to examples/site/testing_http/http_unit_test.cc