Skip to content

Commit

Permalink
format_sql test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
anarthal committed Jan 29, 2024
1 parent bf6ad45 commit 0f3ffb5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/unit/test/format_sql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <boost/optional/optional.hpp>
#include <boost/test/unit_test.hpp>

#include <cmath>
#include <cstddef>
#include <limits>
#include <string>
Expand Down Expand Up @@ -117,7 +118,7 @@ BOOST_AUTO_TEST_CASE(individual_int)
{
BOOST_TEST(format_sql(single_fmt, opts, (int)42) == "SELECT 42;");
BOOST_TEST(format_sql(single_fmt, opts, (int)-1) == "SELECT -1;");
BOOST_TEST(format_sql(single_fmt, opts, (int)-2147483648) == "SELECT -2147483648;");
BOOST_TEST(format_sql(single_fmt, opts, (int)-0x7fffffff - 1) == "SELECT -2147483648;");
BOOST_TEST(format_sql(single_fmt, opts, (int)0x7fffffff) == "SELECT 2147483647;");
}

Expand Down Expand Up @@ -369,7 +370,7 @@ BOOST_AUTO_TEST_CASE(individual_identifier)

BOOST_AUTO_TEST_CASE(individual_custom_type)
{
auto actual = format_sql("SELECT * FROM myt WHERE {}", opts, custom::condition("myfield", 42));
auto actual = format_sql("SELECT * FROM myt WHERE {}", opts, custom::condition{"myfield", 42});
string_view expected = "SELECT * FROM myt WHERE `myfield`=42";
BOOST_TEST(actual == expected);
}
Expand Down Expand Up @@ -633,7 +634,7 @@ BOOST_AUTO_TEST_CASE(format_context_success)
BOOST_TEST(get(format_context(opts).append_value(identifier("abc`d"))) == "`abc``d`");

// Custom values work
BOOST_TEST(get(format_context(opts).append_value(custom::condition("id", 42))) == "`id`=42");
BOOST_TEST(get(format_context(opts).append_value(custom::condition{"id", 42})) == "`id`=42");

// Raw/value combinations
BOOST_TEST(get(format_context(opts).append_raw("SELECT ").append_value(42)) == "SELECT 42");
Expand Down

0 comments on commit 0f3ffb5

Please sign in to comment.