Commit c50f9bb9 authored by Kenton Varda's avatar Kenton Varda

Oops that last change broke everything due to stringification of Vector<char> becoming ambiguous.

parent 6f03c6a9
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "string.h" #include "string.h"
#include <kj/compat/gtest.h> #include <kj/compat/gtest.h>
#include <string> #include <string>
#include "vector.h"
namespace kj { namespace kj {
namespace _ { // private namespace _ { // private
...@@ -38,11 +39,15 @@ TEST(String, Str) { ...@@ -38,11 +39,15 @@ TEST(String, Str) {
char buf[3] = {'f', 'o', 'o'}; char buf[3] = {'f', 'o', 'o'};
kj::ArrayPtr<char> a = buf; kj::ArrayPtr<char> a = buf;
kj::ArrayPtr<const char> ca = a; kj::ArrayPtr<const char> ca = a;
kj::Vector<char> v;
v.addAll(a);
EXPECT_EQ("foo", str(a)); EXPECT_EQ("foo", str(a));
EXPECT_EQ("foo", str(ca)); EXPECT_EQ("foo", str(ca));
EXPECT_EQ("foo", str(v));
EXPECT_EQ("foo", str(mv(a))); EXPECT_EQ("foo", str(mv(a)));
EXPECT_EQ("foo", str(mv(ca))); EXPECT_EQ("foo", str(mv(ca)));
EXPECT_EQ("foo", str(mv(v)));
} }
TEST(String, StartsEndsWith) { TEST(String, StartsEndsWith) {
......
...@@ -119,6 +119,11 @@ private: ...@@ -119,6 +119,11 @@ private:
} }
}; };
template <typename T>
inline auto KJ_STRINGIFY(const Vector<T>& v) -> decltype(toCharSequence(v.asPtr())) {
return toCharSequence(v.asPtr());
}
} // namespace kj } // namespace kj
#endif // KJ_VECTOR_H_ #endif // KJ_VECTOR_H_
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