Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 425fc8d

Browse files
Update Invalid URI test for CDRIVER-5983 (#1429)
1 parent ad62203 commit 425fc8d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

‎src/mongocxx/test/v_noabi/uri.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
#include <bsoncxx/test/catch.hh>
2727

28+
#include <catch2/matchers/catch_matchers_string.hpp>
29+
2830
namespace {
2931
TEST_CASE("URI", "[uri]") {
3032
SECTION("Default URI") {
@@ -72,9 +74,16 @@ TEST_CASE("URI", "[uri]") {
7274
} catch (mongocxx::logic_error const& e) {
7375
REQUIRE(e.code() == mongocxx::error_code::k_invalid_uri);
7476

75-
std::string invalid_schema = "Invalid URI Schema, expecting 'mongodb://' or 'mongodb+srv://': ";
76-
77-
REQUIRE(e.what() == invalid_schema + e.code().message());
77+
// Message format slightly changes between mongoc 2.0.0 and 2.1.0. (CDRIVER-5983)
78+
// Invalid URI Schema, expecting 'mongodb://' or 'mongodb+srv://': ...
79+
// ->
80+
// Invalid URI scheme "mongo://". Expected one of "mongodb://" or "mongodb+srv://": ...
81+
// https://github.com/mongodb/mongo-c-driver/commit/e388c29bc12b9d9568cde4fca6f95f6fba3289aa#diff-dbe89a1dfeb43b78de3fd2a755697ea837b1e6f6cc8fd589476e64d4fb873700R1985-R1987
82+
REQUIRE_THAT(
83+
e.what(),
84+
Catch::Matchers::ContainsSubstring("Invalid URI") && Catch::Matchers::ContainsSubstring("mongodb://") &&
85+
Catch::Matchers::ContainsSubstring("mongodb+srv://") &&
86+
Catch::Matchers::ContainsSubstring(e.code().message()));
7887
}
7988
}
8089

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /