Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions google/cloud/bigtable/bytes.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class Bytes {
/// An empty sequence.
Bytes() = default;

/// Stops copying at the null-terminator character from input bytes.
explicit Bytes(char const* bytes) : bytes_(bytes) {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to have a unit test to verify the fix this change is aiming to make?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updates I had to make to the existing test is probably the only way to verify the new behavior.


/// @name Construction from a sequence of octets.
///@{
template <typename InputIt>
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/bigtable/bytes_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ TEST(Bytes, OutputStream) {
{Bytes(std::string("a\377B")), R"(B"a\377B")"},
{Bytes(std::string("!@#$%^&*()-.")), R"(B"!@#$%^&*()-.")"},
{Bytes(std::string(3, '\0')), R"(B"\000\000\000")"},
{Bytes(""), R"(B"\000")"},
{Bytes("foo"), R"(B"foo\000")"},
{Bytes(""), R"(B"")"},
{Bytes("foo"), R"(B"foo")"},
};

for (auto const& tc : test_cases) {
Expand Down