@@ -295,7 +295,7 @@ TEST_CASE("ResolvePositionalInserts substitutes real column names", "[lup2dbtool
295295 c.tableName = " cfg" ;
296296 c.columns .push_back ({ .name = " nr" , .type = " integer" });
297297 c.columns .push_back ({ .name = " val" , .type = " integer" });
298- m1.statements .push_back ({ {}, c });
298+ m1.statements .push_back ({ . comments = {}, . statement = c });
299299 }
300300
301301 ParsedMigration m2;
@@ -306,7 +306,7 @@ TEST_CASE("ResolvePositionalInserts substitutes real column names", "[lup2dbtool
306306 i.tableName = " cfg" ;
307307 i.columnValues .emplace_back (" 0" , " 4" );
308308 i.columnValues .emplace_back (" 1" , " 215" );
309- m2.statements .push_back ({ {}, i });
309+ m2.statements .push_back ({ . comments = {}, . statement = i });
310310 }
311311
312312 std::vector migrations { m1, m2 };
@@ -328,21 +328,21 @@ TEST_CASE("ResolvePositionalInserts tracks ALTER TABLE ADD COLUMN", "[lup2dbtool
328328 CreateTableStmt c;
329329 c.tableName = " t" ;
330330 c.columns .push_back ({ .name = " id" , .type = " integer" });
331- m.statements .push_back ({ {}, c });
331+ m.statements .push_back ({ . comments = {}, . statement = c });
332332 }
333333 {
334334 AlterTableAddColumnStmt a;
335335 a.tableName = " t" ;
336336 a.column .name = " extra" ;
337337 a.column .type = " integer" ;
338- m.statements .push_back ({ {}, a });
338+ m.statements .push_back ({ . comments = {}, . statement = a });
339339 }
340340 {
341341 InsertStmt i;
342342 i.tableName = " t" ;
343343 i.columnValues .emplace_back (" 0" , " 1" );
344344 i.columnValues .emplace_back (" 1" , " 99" );
345- m.statements .push_back ({ {}, i });
345+ m.statements .push_back ({ . comments = {}, . statement = i });
346346 }
347347
348348 std::vector migrations { m };
@@ -361,14 +361,14 @@ TEST_CASE("ResolvePositionalInserts leaves out-of-bounds indices untouched", "[l
361361 CreateTableStmt c;
362362 c.tableName = " t" ;
363363 c.columns .push_back ({ .name = " id" , .type = " integer" });
364- m.statements .push_back ({ {}, c });
364+ m.statements .push_back ({ . comments = {}, . statement = c });
365365 }
366366 {
367367 InsertStmt i;
368368 i.tableName = " t" ;
369369 i.columnValues .emplace_back (" 0" , " 1" );
370370 i.columnValues .emplace_back (" 1" , " bogus" ); // Table has only 1 column.
371- m.statements .push_back ({ {}, i });
371+ m.statements .push_back ({ . comments = {}, . statement = i });
372372 }
373373
374374 std::vector migrations { m };
@@ -525,8 +525,8 @@ TEST_CASE("ParseSqlStatement.Update.ExistsSubqueryIsStructured", "[lup2dbtool]")
525525 REQUIRE (std::holds_alternative<UpdateStmt>(stmt));
526526 auto const & u = std::get<UpdateStmt>(stmt);
527527 CHECK (u.tableName == " docs" );
528- CHECK (u.whereExpression .find (" EXISTS (" ) != std::string::npos );
529- CHECK (u.whereExpression .find (R"( "FOLDER" IS NULL)" ) != std::string::npos );
528+ CHECK (u.whereExpression .contains (" EXISTS (" ));
529+ CHECK (u.whereExpression .contains (R"( "FOLDER" IS NULL)" ));
530530}
531531
532532TEST_CASE (" ParseSqlStatement.Update.WhereIsNull" , " [lup2dbtool]" )
@@ -913,24 +913,24 @@ TEST_CASE("GeneratePluginCMake.UsesPluginName", "[lup2dbtool]")
913913 auto const script = out.str ();
914914
915915 // Plugin name appears everywhere a target name would: add_library, GLOB variable, link, properties.
916- CHECK (script.find (" add_library(MyMigrations MODULE" ) != std::string::npos );
917- CHECK (script.find (" target_link_libraries(MyMigrations PRIVATE Lightweight::Lightweight" ) != std::string::npos );
918- CHECK (script.find (" ${MyMigrations_MIGRATIONS}" ) != std::string::npos );
916+ CHECK (script.contains (" add_library(MyMigrations MODULE" ));
917+ CHECK (script.contains (" target_link_libraries(MyMigrations PRIVATE Lightweight::Lightweight" ));
918+ CHECK (script.contains (" ${MyMigrations_MIGRATIONS}" ));
919919 // Plugin.cpp is the entry point the script must compile alongside the generated sources.
920- CHECK (script.find (" Plugin.cpp" ) != std::string::npos );
920+ CHECK (script.contains (" Plugin.cpp" ));
921921 // CONFIGURE_DEPENDS glob keeps lup_*.cpp additions cheap.
922- CHECK (script.find (" CONFIGURE_DEPENDS" ) != std::string::npos );
923- CHECK (script.find (" lup_*.cpp" ) != std::string::npos );
922+ CHECK (script.contains (" CONFIGURE_DEPENDS" ));
923+ CHECK (script.contains (" lup_*.cpp" ));
924924 // Output destination matches the existing plugin convention.
925- CHECK (script.find (" ${CMAKE_BINARY_DIR}/plugins" ) != std::string::npos );
925+ CHECK (script.contains (" ${CMAKE_BINARY_DIR}/plugins" ));
926926}
927927
928928TEST_CASE (" GeneratePluginCMake.DefaultPluginName" , " [lup2dbtool]" )
929929{
930930 std::ostringstream out;
931931 CodeGenerator::GeneratePluginCMake (out, " LupMigrations" );
932932 auto const script = out.str ();
933- CHECK (script.find (" add_library(LupMigrations MODULE" ) != std::string::npos );
933+ CHECK (script.contains (" add_library(LupMigrations MODULE" ));
934934}
935935
936936TEST_CASE (" GeneratePluginEntryPoint.DeclaresPluginMacro" , " [lup2dbtool]" )
@@ -939,8 +939,8 @@ TEST_CASE("GeneratePluginEntryPoint.DeclaresPluginMacro", "[lup2dbtool]")
939939 CodeGenerator::GeneratePluginEntryPoint (out);
940940 auto const src = out.str ();
941941
942- CHECK (src.find (" #include <Lightweight/SqlMigration.hpp>" ) != std::string::npos );
943- CHECK (src.find (" LIGHTWEIGHT_MIGRATION_PLUGIN()" ) != std::string::npos );
942+ CHECK (src.contains (" #include <Lightweight/SqlMigration.hpp>" ));
943+ CHECK (src.contains (" LIGHTWEIGHT_MIGRATION_PLUGIN()" ));
944944}
945945
946946// ================================================================================================
@@ -1019,7 +1019,7 @@ TEST_CASE("ParseSqlFile.AutoMode.PassesThroughUtf8", "[lup2dbtool]")
10191019 // The byte payload should still contain the original UTF-8 bytes, untouched.
10201020 bool foundUtf8 = false ;
10211021 for (auto const & [_, value]: stmt.columnValues )
1022- if (value.find (" \xC3\xA4 " ) != std::string::npos )
1022+ if (value.contains (" \xC3\xA4 " ))
10231023 foundUtf8 = true ;
10241024 CHECK (foundUtf8);
10251025 RemoveQuiet (path);
@@ -1040,9 +1040,9 @@ TEST_CASE("ParseSqlFile.AutoMode.ConvertsWindows1252", "[lup2dbtool]")
10401040 bool foundLatin1 = false ;
10411041 for (auto const & [_, value]: stmt.columnValues )
10421042 {
1043- if (value.find (" \xC3\xA4 " ) != std::string::npos )
1043+ if (value.contains (" \xC3\xA4 " ))
10441044 foundUtf8 = true ;
1045- if (value.find (' \xE4 ' ) != std::string::npos && value.find (" \xC3\xA4 " ) == std::string::npos )
1045+ if (value.contains (' \xE4 ' ) && ! value.contains (" \xC3\xA4 " ))
10461046 foundLatin1 = true ;
10471047 }
10481048 CHECK (foundUtf8);
@@ -1072,8 +1072,8 @@ TEST_CASE("ParseSqlFile.ExplicitUtf8RejectsWindows1252", "[lup2dbtool]")
10721072 auto const result = ParseSqlFile (path, ParserConfig { .inputEncoding = " utf-8" });
10731073 REQUIRE_FALSE (result.has_value ());
10741074 INFO (" Error message: " << result.error ());
1075- CHECK (result.error ().find (" invalid UTF-8" ) != std::string::npos );
1076- CHECK (result.error ().find (" utf-8" ) != std::string::npos );
1075+ CHECK (result.error ().contains (" invalid UTF-8" ));
1076+ CHECK (result.error ().contains (" utf-8" ));
10771077 RemoveQuiet (path);
10781078}
10791079
@@ -1085,7 +1085,7 @@ TEST_CASE("ParseSqlFile.ExplicitWindows1252RejectsUtf8", "[lup2dbtool]")
10851085 auto const path = WriteTempSqlFile (" 9_99_05" , " INSERT INTO T VALUES (1, 'M\xC3\xA4 ller')\n " );
10861086 auto const result = ParseSqlFile (path, ParserConfig { .inputEncoding = " windows-1252" });
10871087 REQUIRE_FALSE (result.has_value ());
1088- CHECK (result.error ().find (" validates as UTF-8" ) != std::string::npos );
1088+ CHECK (result.error ().contains (" validates as UTF-8" ));
10891089 RemoveQuiet (path);
10901090}
10911091
0 commit comments