Skip to content

Commit 8cb15c4

Browse files
authored
refactor: move http testing examples to subdirectory (#190)
1 parent 1c99888 commit 8cb15c4

File tree

5 files changed

+48
-13
lines changed

5 files changed

+48
-13
lines changed

examples/CMakeLists.txt

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,9 @@ if (BUILD_TESTING)
5858
find_package(GTest CONFIG REQUIRED)
5959
set(googleapis_functions_framework_examples_unit_tests
6060
# cmake-format: sort
61-
cloud_event_examples_test.cc http_examples_test.cc
62-
http_integration_test.cc http_unit_test.cc site_test.cc)
61+
cloud_event_examples_test.cc http_examples_test.cc site_test.cc)
6362

64-
set(googleapis_functions_framework_examples_programs
65-
# cmake-format: sort
66-
http_integration_server.cc)
67-
68-
foreach (fname ${googleapis_functions_framework_examples_unit_tests}
69-
${googleapis_functions_framework_examples_programs})
63+
foreach (fname ${googleapis_functions_framework_examples_unit_tests})
7064
string(REPLACE "/" "_" target "${fname}")
7165
string(REPLACE ".cc" "" target "${target}")
7266
add_executable("${target}" ${fname})
@@ -75,11 +69,8 @@ if (BUILD_TESTING)
7569
PRIVATE functions_framework_examples googleapis_functions_framework
7670
Boost::filesystem GTest::gmock_main GTest::gmock
7771
GTest::gtest)
78-
endforeach ()
79-
80-
foreach (fname ${googleapis_functions_framework_examples_unit_tests})
81-
string(REPLACE "/" "_" target "${fname}")
82-
string(REPLACE ".cc" "" target "${target}")
8372
add_test(NAME ${target} COMMAND ${target})
8473
endforeach ()
8574
endif ()
75+
76+
add_subdirectory(site/testing_http)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# ~~~
2+
# Copyright 2020 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# ~~~
16+
17+
if (BUILD_TESTING)
18+
find_package(GTest CONFIG REQUIRED)
19+
set(googleapis_functions_framework_examples_unit_tests
20+
# cmake-format: sort
21+
http_integration_test.cc http_unit_test.cc)
22+
23+
set(googleapis_functions_framework_examples_programs
24+
# cmake-format: sort
25+
http_integration_server.cc)
26+
27+
foreach (fname ${googleapis_functions_framework_examples_unit_tests}
28+
${googleapis_functions_framework_examples_programs})
29+
string(REPLACE "/" "_" target "${fname}")
30+
string(REPLACE ".cc" "" target "${target}")
31+
add_executable("${target}" ${fname})
32+
target_link_libraries(
33+
${target}
34+
PRIVATE functions_framework_examples googleapis_functions_framework
35+
Boost::filesystem GTest::gmock_main GTest::gmock
36+
GTest::gtest)
37+
endforeach ()
38+
39+
foreach (fname ${googleapis_functions_framework_examples_unit_tests})
40+
string(REPLACE "/" "_" target "${fname}")
41+
string(REPLACE ".cc" "" target "${target}")
42+
add_test(NAME ${target} COMMAND ${target})
43+
endforeach ()
44+
endif ()
File renamed without changes.

0 commit comments

Comments
 (0)