Commit 4def671a authored by Kenton Varda's avatar Kenton Varda

Fix another problem, ugh.

parent c50f9bb9
......@@ -37,17 +37,21 @@ TEST(String, Str) {
str((int8_t)123, " ", (uint8_t)234, " ", (int8_t)-123, " ", hex((uint8_t)0xe7)));
char buf[3] = {'f', 'o', 'o'};
kj::ArrayPtr<char> a = buf;
kj::ArrayPtr<const char> ca = a;
kj::Vector<char> v;
ArrayPtr<char> a = buf;
ArrayPtr<const char> ca = a;
Vector<char> v;
v.addAll(a);
FixedArray<char, 3> f;
memcpy(f.begin(), buf, 3);
EXPECT_EQ("foo", str(a));
EXPECT_EQ("foo", str(ca));
EXPECT_EQ("foo", str(v));
EXPECT_EQ("foo", str(f));
EXPECT_EQ("foo", str(mv(a)));
EXPECT_EQ("foo", str(mv(ca)));
EXPECT_EQ("foo", str(mv(v)));
EXPECT_EQ("foo", str(mv(f)));
}
TEST(String, StartsEndsWith) {
......
......@@ -265,6 +265,8 @@ struct Stringifier {
inline ArrayPtr<const char> operator*(const Array<char>& s) const { return s; }
template<size_t n>
inline ArrayPtr<const char> operator*(const CappedArray<char, n>& s) const { return s; }
template<size_t n>
inline ArrayPtr<const char> operator*(const FixedArray<char, n>& s) const { return s; }
inline ArrayPtr<const char> operator*(const char* s) const { return arrayPtr(s, strlen(s)); }
inline ArrayPtr<const char> operator*(const String& s) const { return s.asArray(); }
inline ArrayPtr<const char> operator*(const StringPtr& s) const { return s.asArray(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment