Skip to content

Commit 253ba2e

Browse files
authored
CXX-2753 Move test files into test subdirectory (#1041)
1 parent 38467f8 commit 253ba2e

File tree

96 files changed

+141
-135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+141
-135
lines changed

src/bsoncxx/lib/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ set_dist_list(src_bsoncxx_lib_DIST
8888
bsoncxx/v_noabi/bsoncxx/private/stack.hh
8989
bsoncxx/v_noabi/bsoncxx/private/suppress_deprecation_warnings.hh
9090
bsoncxx/v_noabi/bsoncxx/string/view_or_value.cpp
91-
bsoncxx/v_noabi/bsoncxx/test_util/catch.hh
9291
bsoncxx/v_noabi/bsoncxx/test_util/export_for_testing.hh
93-
bsoncxx/v_noabi/bsoncxx/test_util/to_string.hh
9492
bsoncxx/v_noabi/bsoncxx/types.cpp
9593
bsoncxx/v_noabi/bsoncxx/types/bson_value/private/value.hh
9694
bsoncxx/v_noabi/bsoncxx/types/bson_value/value.cpp

src/bsoncxx/test/CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ endif()
2424

2525
target_compile_definitions(bsoncxx_testing PUBLIC BSONCXX_TESTING)
2626

27-
# Allow `#include <third_party/catch/include/...>`
28-
target_include_directories(bsoncxx_testing PUBLIC ${THIRD_PARTY_SOURCE_DIR}/..)
29-
3027
add_executable(test_bson
3128
array.cpp
3229
bson_b_date.cpp
@@ -46,7 +43,13 @@ add_executable(test_bson
4643
add_library(bsoncxx_test_properties INTERFACE)
4744
target_sources(bsoncxx_test_properties INTERFACE ${THIRD_PARTY_SOURCE_DIR}/catch/main.cpp)
4845
target_link_libraries(bsoncxx_test_properties INTERFACE bsoncxx_testing ${libbson_target})
49-
target_include_directories(bsoncxx_test_properties INTERFACE ${libbson_include_directories})
46+
target_include_directories(bsoncxx_test_properties INTERFACE
47+
# Allow `#include <bson/bson.h>`
48+
${libbson_include_directories}
49+
50+
# Allow `#include <bsoncxx/test/...>` and `#include <third_party/...>`.
51+
${CMAKE_CURRENT_SOURCE_DIR}/../..
52+
)
5053
target_compile_definitions(bsoncxx_test_properties INTERFACE ${libbson_definitions})
5154

5255
target_link_libraries(test_bson PRIVATE bsoncxx_test_properties)
@@ -64,7 +67,9 @@ set_dist_list(src_bsoncxx_test_DIST
6467
bson_util_itoa.cpp
6568
bson_validate.cpp
6669
bson_value.cpp
70+
catch.hh
6771
json.cpp
6872
oid.cpp
73+
to_string.hh
6974
view_or_value.cpp
7075
)

src/bsoncxx/test/array.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <bsoncxx/array/view.hpp>
1616
#include <bsoncxx/builder/basic/array.hpp>
17-
#include <bsoncxx/test_util/catch.hh>
17+
#include <bsoncxx/test/catch.hh>
1818
#include <bsoncxx/types.hpp>
1919
#include <bsoncxx/types/bson_value/make_value.hpp>
2020

src/bsoncxx/test/bson_b_date.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <chrono>
1616

17-
#include <bsoncxx/test_util/catch.hh>
17+
#include <bsoncxx/test/catch.hh>
1818
#include <bsoncxx/types.hpp>
1919

2020
namespace {

src/bsoncxx/test/bson_builder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <bsoncxx/json.hpp>
2525
#include <bsoncxx/private/libbson.hh>
2626
#include <bsoncxx/string/to_string.hpp>
27-
#include <bsoncxx/test_util/catch.hh>
27+
#include <bsoncxx/test/catch.hh>
2828
#include <bsoncxx/types.hpp>
2929
#include <bsoncxx/types/bson_value/view.hpp>
3030

src/bsoncxx/test/bson_get_values.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <bsoncxx/builder/basic/array.hpp>
1818
#include <bsoncxx/builder/basic/document.hpp>
1919
#include <bsoncxx/builder/basic/sub_array.hpp>
20-
#include <bsoncxx/test_util/catch.hh>
20+
#include <bsoncxx/test/catch.hh>
2121

2222
namespace {
2323
using namespace bsoncxx;

src/bsoncxx/test/bson_serialization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <bsoncxx/builder/basic/document.hpp>
1818
#include <bsoncxx/document/value.hpp>
1919
#include <bsoncxx/string/to_string.hpp>
20-
#include <bsoncxx/test_util/catch.hh>
20+
#include <bsoncxx/test/catch.hh>
2121
#include <bsoncxx/types/bson_value/view.hpp>
2222

2323
namespace {

src/bsoncxx/test/bson_types.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <bsoncxx/builder/basic/document.hpp>
1919
#include <bsoncxx/document/element.hpp>
2020
#include <bsoncxx/stdx/string_view.hpp>
21-
#include <bsoncxx/test_util/catch.hh>
21+
#include <bsoncxx/test/catch.hh>
2222
#include <bsoncxx/types.hpp>
2323
#include <bsoncxx/types/bson_value/view.hpp>
2424

src/bsoncxx/test/bson_util_itoa.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
#include <bsoncxx/private/itoa.hh>
16-
#include <bsoncxx/test_util/catch.hh>
16+
#include <bsoncxx/test/catch.hh>
1717

1818
namespace {
1919
TEST_CASE("util::itoa is equivalent to to_string(int)", "[bsoncxx::util::itoa]") {

src/bsoncxx/test/bson_validate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <bsoncxx/builder/basic/document.hpp>
1919
#include <bsoncxx/builder/basic/kvp.hpp>
2020
#include <bsoncxx/builder/basic/sub_array.hpp>
21-
#include <bsoncxx/test_util/catch.hh>
21+
#include <bsoncxx/test/catch.hh>
2222
#include <bsoncxx/validate.hpp>
2323

2424
namespace {

src/bsoncxx/test/bson_value.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <bsoncxx/builder/basic/document.hpp>
2020
#include <bsoncxx/builder/basic/kvp.hpp>
2121
#include <bsoncxx/document/view.hpp>
22-
#include <bsoncxx/test_util/catch.hh>
22+
#include <bsoncxx/test/catch.hh>
2323
#include <bsoncxx/types/bson_value/make_value.hpp>
2424
#include <bsoncxx/types/bson_value/value.hpp>
2525
#include <bsoncxx/types/bson_value/view.hpp>

src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/test_util/catch.hh renamed to src/bsoncxx/test/catch.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <bsoncxx/json.hpp>
1919
#include <bsoncxx/oid.hpp>
2020
#include <bsoncxx/stdx/optional.hpp>
21-
#include <bsoncxx/test_util/to_string.hh>
21+
#include <bsoncxx/test/to_string.hh>
2222
#include <third_party/catch/include/catch.hpp>
2323

2424
#include <bsoncxx/config/private/prelude.hh>

src/bsoncxx/test/json.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <bsoncxx/exception/exception.hpp>
2020
#include <bsoncxx/json.hpp>
2121
#include <bsoncxx/private/libbson.hh>
22-
#include <bsoncxx/test_util/catch.hh>
22+
#include <bsoncxx/test/catch.hh>
2323

2424
namespace {
2525
using bsoncxx::builder::basic::kvp;

src/bsoncxx/test/oid.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#include <bsoncxx/oid.hpp>
2323
#include <bsoncxx/private/libbson.hh>
24-
#include <bsoncxx/test_util/catch.hh>
24+
#include <bsoncxx/test/catch.hh>
2525

2626
using namespace bsoncxx;
2727

src/bsoncxx/test/view_or_value.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <bsoncxx/document/view_or_value.hpp>
2020
#include <bsoncxx/json.hpp>
2121
#include <bsoncxx/string/view_or_value.hpp>
22-
#include <bsoncxx/test_util/catch.hh>
22+
#include <bsoncxx/test/catch.hh>
2323

2424
namespace {
2525
using namespace bsoncxx;

src/mongocxx/lib/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,6 @@ set_dist_list(src_mongocxx_lib_DIST
278278
mongocxx/v_noabi/mongocxx/result/update.cpp
279279
mongocxx/v_noabi/mongocxx/search_index_model.cpp
280280
mongocxx/v_noabi/mongocxx/search_index_view.cpp
281-
mongocxx/v_noabi/mongocxx/test_util/client_helpers.cpp
282-
mongocxx/v_noabi/mongocxx/test_util/client_helpers.hh
283281
mongocxx/v_noabi/mongocxx/test_util/export_for_testing.hh
284282
mongocxx/v_noabi/mongocxx/test_util/mock.hh
285283
mongocxx/v_noabi/mongocxx/uri.cpp

src/mongocxx/test/CMakeLists.txt

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
2929
target_compile_options(mongocxx_mocked PRIVATE /bigobj)
3030
endif()
3131

32-
# Allow `#include <third_party/catch/include/...>`
33-
target_include_directories(mongocxx_mocked PUBLIC ${THIRD_PARTY_SOURCE_DIR}/..)
34-
3532
set(spec_test_common
3633
spec/operation.cpp
3734
spec/unified_tests/entity.cpp
@@ -40,11 +37,10 @@ set(spec_test_common
4037
spec/util.cpp
4138
)
4239

43-
set(client_helpers_cpp ${PROJECT_SOURCE_DIR}/lib/mongocxx/v_noabi/mongocxx/test_util/client_helpers.cpp)
44-
4540
add_executable(test_driver
4641
bulk_write.cpp
4742
change_streams.cpp
43+
client_helpers.cpp
4844
client_session.cpp
4945
client_side_encryption.cpp
5046
client.cpp
@@ -105,7 +101,6 @@ add_executable(test_driver
105101
uri.cpp
106102
validation_criteria.cpp
107103
write_concern.cpp
108-
${client_helpers_cpp}
109104
)
110105

111106
add_executable(test_logging
@@ -119,69 +114,75 @@ add_executable(test_instance
119114
add_executable(test_crud_specs
120115
spec/crud.cpp
121116
${spec_test_common}
122-
${client_helpers_cpp}
117+
client_helpers.cpp
123118
)
124119

125120
add_executable(test_gridfs_specs
126121
spec/gridfs.cpp
127122
${spec_test_common}
128-
${client_helpers_cpp}
123+
client_helpers.cpp
129124
)
130125

131126
add_executable(test_client_side_encryption_specs
132127
spec/client_side_encryption.cpp
133128
${spec_test_common}
134-
${client_helpers_cpp}
129+
client_helpers.cpp
135130
)
136131

137132
add_executable(test_command_monitoring_specs
138133
spec/command_monitoring.cpp
139134
${spec_test_common}
140-
${client_helpers_cpp}
135+
client_helpers.cpp
141136
)
142137

143138
add_executable(test_transactions_specs
144139
spec/transactions.cpp
145140
${spec_test_common}
146-
${client_helpers_cpp}
141+
client_helpers.cpp
147142
)
148143

149144
add_executable(test_retryable_reads_specs
150145
spec/retryable-reads.cpp
151146
${spec_test_common}
152-
${client_helpers_cpp}
147+
client_helpers.cpp
153148
)
154149

155150
add_executable(test_read_write_concern_specs
156151
spec/read_write_concern.cpp
157152
${spec_test_common}
158-
${client_helpers_cpp}
153+
client_helpers.cpp
159154
)
160155

161156
add_executable(test_mongohouse_specs
162157
spec/mongohouse.cpp
163158
${spec_test_common}
164-
${client_helpers_cpp}
159+
client_helpers.cpp
165160
)
166161

167162
add_executable(test_unified_format_spec
168163
spec/unified_tests/operations.cpp
169164
spec/unified_tests/runner.cpp
170165
${spec_test_common}
171-
${client_helpers_cpp}
166+
client_helpers.cpp
172167
)
173168

174169
add_executable(test_versioned_api
175170
versioned_api.cpp
176171
${spec_test_common}
177-
${client_helpers_cpp}
172+
client_helpers.cpp
178173
)
179174

180175
# Common target properties for test executables.
181176
add_library(mongocxx_test_properties INTERFACE)
182177
target_sources(mongocxx_test_properties INTERFACE ${THIRD_PARTY_SOURCE_DIR}/catch/main.cpp)
183178
target_link_libraries(mongocxx_test_properties INTERFACE mongocxx_mocked ${libmongoc_target})
184-
target_include_directories(mongocxx_test_properties INTERFACE ${libmongoc_include_directories})
179+
target_include_directories(mongocxx_test_properties INTERFACE
180+
# Allow `#include <mongoc/mongoc.h>`
181+
${libmongoc_include_directories}
182+
183+
# Allow `#include <mongocxx/test/...>` and `#include <third_party/...>`.
184+
${CMAKE_CURRENT_SOURCE_DIR}/../..
185+
)
185186

186187
target_link_libraries(test_driver PRIVATE mongocxx_test_properties)
187188
target_link_libraries(test_logging PRIVATE mongocxx_test_properties)
@@ -289,6 +290,8 @@ set_dist_list(src_mongocxx_test_DIST
289290
CMakeLists.txt
290291
bulk_write.cpp
291292
change_streams.cpp
293+
client_helpers.cpp
294+
client_helpers.hh
292295
client_session.cpp
293296
client_side_encryption.cpp
294297
client.cpp

src/mongocxx/test/bulk_write.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
#include <bsoncxx/builder/basic/document.hpp>
16-
#include <bsoncxx/test_util/catch.hh>
16+
#include <bsoncxx/test/catch.hh>
1717
#include <bsoncxx/types.hpp>
1818
#include <mongocxx/bulk_write.hpp>
1919
#include <mongocxx/client.hpp>

src/mongocxx/test/change_streams.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <bsoncxx/builder/basic/document.hpp>
1919
#include <bsoncxx/document/value.hpp>
2020
#include <bsoncxx/private/libbson.hh>
21-
#include <bsoncxx/test_util/catch.hh>
21+
#include <bsoncxx/test/catch.hh>
2222
#include <mongocxx/client.hpp>
2323
#include <mongocxx/collection.hpp>
2424
#include <mongocxx/instance.hpp>
@@ -27,7 +27,7 @@
2727
#include <mongocxx/pipeline.hpp>
2828
#include <mongocxx/pool.hpp>
2929
#include <mongocxx/private/libbson.hh>
30-
#include <mongocxx/test_util/client_helpers.hh>
30+
#include <mongocxx/test/client_helpers.hh>
3131
#include <mongocxx/write_concern.hpp>
3232
#include <third_party/catch/include/helpers.hpp>
3333

src/mongocxx/test/client.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
// limitations under the License.
1414

1515
#include <bsoncxx/string/to_string.hpp>
16-
#include <bsoncxx/test_util/catch.hh>
16+
#include <bsoncxx/test/catch.hh>
1717
#include <mongocxx/client.hpp>
1818
#include <mongocxx/exception/logic_error.hpp>
1919
#include <mongocxx/instance.hpp>
2020
#include <mongocxx/pool.hpp>
2121
#include <mongocxx/private/conversions.hh>
2222
#include <mongocxx/private/libmongoc.hh>
23-
#include <mongocxx/test_util/client_helpers.hh>
23+
#include <mongocxx/test/client_helpers.hh>
2424
#include <mongocxx/uri.hpp>
2525
#include <third_party/catch/include/helpers.hpp>
2626

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include <mongocxx/exception/logic_error.hpp>
3636
#include <mongocxx/exception/operation_exception.hpp>
3737
#include <mongocxx/private/libmongoc.hh>
38-
#include <mongocxx/test_util/client_helpers.hh>
38+
#include <mongocxx/test/client_helpers.hh>
3939
#include <third_party/catch/include/catch.hpp>
4040

4141
#include <mongocxx/config/private/prelude.hh>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
#include <bsoncxx/stdx/string_view.hpp>
2828
#include <bsoncxx/types.hpp>
2929
#include <bsoncxx/types/bson_value/view.hpp>
30+
#include <mongocxx/client.hpp>
3031
#include <mongocxx/collection.hpp>
32+
#include <mongocxx/options/client.hpp>
3133
#include <mongocxx/stdx.hpp>
3234
#include <third_party/catch/include/catch.hpp>
3335

src/mongocxx/test/client_session.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
#include <bsoncxx/private/helpers.hh>
1818
#include <bsoncxx/stdx/make_unique.hpp>
19-
#include <bsoncxx/test_util/catch.hh>
19+
#include <bsoncxx/test/catch.hh>
2020
#include <mongocxx/client.hpp>
2121
#include <mongocxx/exception/bulk_write_exception.hpp>
2222
#include <mongocxx/exception/logic_error.hpp>
2323
#include <mongocxx/exception/server_error_code.hpp>
2424
#include <mongocxx/instance.hpp>
2525
#include <mongocxx/private/libmongoc.hh>
26-
#include <mongocxx/test_util/client_helpers.hh>
26+
#include <mongocxx/test/client_helpers.hh>
2727
#include <third_party/catch/include/helpers.hpp>
2828

2929
namespace {

src/mongocxx/test/client_side_encryption.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <bsoncxx/document/element.hpp>
2424
#include <bsoncxx/stdx/make_unique.hpp>
2525
#include <bsoncxx/stdx/string_view.hpp>
26-
#include <bsoncxx/test_util/catch.hh>
26+
#include <bsoncxx/test/catch.hh>
2727
#include <bsoncxx/types.hpp>
2828
#include <bsoncxx/types/bson_value/make_value.hpp>
2929
#include <bsoncxx/types/bson_value/value.hpp>
@@ -37,8 +37,8 @@
3737
#include <mongocxx/options/client_encryption.hpp>
3838
#include <mongocxx/options/data_key.hpp>
3939
#include <mongocxx/private/libbson.hh>
40+
#include <mongocxx/test/client_helpers.hh>
4041
#include <mongocxx/test/spec/monitoring.hh>
41-
#include <mongocxx/test_util/client_helpers.hh>
4242
#include <mongocxx/uri.hpp>
4343
#include <mongocxx/write_concern.hpp>
4444
#include <third_party/catch/include/helpers.hpp>

0 commit comments

Comments
 (0)