Skip to content

Commit

Permalink
Format. (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtv committed Sep 27, 2023
1 parent 9847c82 commit 7586846
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
14 changes: 6 additions & 8 deletions src/result.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -509,19 +509,17 @@ int pqxx::result::column_storage(pqxx::row::size_type number) const
{
auto const sz{this->size()};
if ((number < 0) or (number >= sz))
throw argument_error{
pqxx::internal::concat(
"Column number out of range: ", number, " (have 0 - ", sz, ")")};
throw failure{
pqxx::internal::concat(
"Error getting column_storage for column ", number)};
throw argument_error{pqxx::internal::concat(
"Column number out of range: ", number, " (have 0 - ", sz, ")")};
throw failure{pqxx::internal::concat(
"Error getting column_storage for column ", number)};
}
return out;
}


int pqxx::result::column_type_modifier(pqxx::row::size_type number)
const noexcept
int pqxx::result::column_type_modifier(
pqxx::row::size_type number) const noexcept
{
return PQfmod(m_data.get(), number);
}
Expand Down
9 changes: 3 additions & 6 deletions test/unit/test_string_conversion.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ void test_string_view_conversion()
using traits = pqxx::string_traits<std::string_view>;

PQXX_CHECK_EQUAL(
pqxx::to_string("view here"sv),
"view here"s,
pqxx::to_string("view here"sv), "view here"s,
"Bad conversion from string_view.");

char buf[200];
Expand All @@ -193,10 +192,8 @@ void test_string_view_conversion()
*(end - 1) == '\0', "string_view into_buf did not zero-terminate.");
PQXX_CHECK_EQUAL(
(std::string{buf, static_cast<std::size_t>(end - std::begin(buf) - 1)}),
"more view"s,
"string_view into_buf wrote wrong data.");
PQXX_CHECK(
*(end - 2) == 'w', "string_view into_buf is in the wrong place.");
"more view"s, "string_view into_buf wrote wrong data.");
PQXX_CHECK(*(end - 2) == 'w', "string_view into_buf is in the wrong place.");

std::string_view org{"another!"sv};
pqxx::zview out{traits::to_buf(std::begin(buf), std::end(buf), org)};
Expand Down
10 changes: 4 additions & 6 deletions test/unit/test_zview.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,18 @@ void test_zview_converts_to_string()
using traits = pqxx::string_traits<pqxx::zview>;

PQXX_CHECK_EQUAL(
pqxx::to_string("hello"_zv),
std::string{"hello"},
pqxx::to_string("hello"_zv), std::string{"hello"},
"to_string on zview failed.");

char buf[100];

auto const v{traits::to_buf(std::begin(buf), std::end(buf), "myview"_zv)};
PQXX_CHECK_EQUAL(std::string{v}, "myview", "to_buf on zview failed.");

auto const p{traits::into_buf(std::begin(buf), std::end(buf), "moreview"_zv)};
auto const p{
traits::into_buf(std::begin(buf), std::end(buf), "moreview"_zv)};
PQXX_CHECK_NOT_EQUAL(
p,
std::begin(buf),
"into_buf on zview returns beginning of buffer.");
p, std::begin(buf), "into_buf on zview returns beginning of buffer.");
PQXX_CHECK(
p > std::begin(buf) and p < std::end(buf),
"into_buf on zview did not store in buffer.");
Expand Down

0 comments on commit 7586846

Please sign in to comment.