Use beast::string_view alias

This commit is contained in:
Vinnie Falco committed 2017-07-20 08:12:16 -07:00
1 parent f50a37b778
commit 84ece031f2
36 files changed
+319 -288

No files matched your search

+1
View File
@@ -30,6 +30,7 @@ add_executable (core-tests
static_buffer.cpp
static_string.cpp
stream_concepts.cpp
string_view.cpp
base64.cpp
empty_base_optimization.cpp
get_lowest_layer.cpp
+13 -13
View File
@@ -123,13 +123,13 @@ public:
}
{
static_string<3> s1(
boost::string_ref("123"));
string_view("123"));
BEAST_EXPECT(s1 == "123");
BEAST_EXPECT(*s1.end() == 0);
try
{
static_string<2> s2(
boost::string_ref("123"));
string_view("123"));
fail("", __FILE__, __LINE__);
}
catch(std::length_error const&)
@@ -232,13 +232,13 @@ public:
}
{
static_string<3> s1;
s1 = boost::string_ref("123");
s1 = string_view("123");
BEAST_EXPECT(s1 == "123");
BEAST_EXPECT(*s1.end() == 0);
try
{
static_string<1> s2;
s2 = boost::string_ref("123");
s2 = string_view("123");
fail("", __FILE__, __LINE__);
}
catch(std::length_error const&)
@@ -370,15 +370,15 @@ public:
}
{
static_string<5> s1;
s1.assign(boost::string_ref("123"));
s1.assign(string_view("123"));
BEAST_EXPECT(s1 == "123");
BEAST_EXPECT(*s1.end() == 0);
s1.assign(boost::string_ref("12345"));
s1.assign(string_view("12345"));
BEAST_EXPECT(s1 == "12345");
BEAST_EXPECT(*s1.end() == 0);
try
{
s1.assign(boost::string_ref("1234567"));
s1.assign(string_view("1234567"));
fail("", __FILE__, __LINE__);
}
catch(std::length_error const&)
@@ -483,7 +483,7 @@ public:
}
{
static_string<3> s("123");
boost::string_ref sv = s;
string_view sv = s;
BEAST_EXPECT(static_string<5>(sv) == "123");
}
}
@@ -750,13 +750,13 @@ public:
}
{
static_string<5> s1("123");
s1.insert(1, boost::string_ref("UV"));
s1.insert(1, string_view("UV"));
BEAST_EXPECT(s1 == "1UV23");
BEAST_EXPECT(*s1.end() == 0);
try
{
static_string<4> s2("123");
s2.insert(1, boost::string_ref("UV"));
s2.insert(1, string_view("UV"));
fail("", __FILE__, __LINE__);
}
catch(std::length_error const&)
@@ -766,7 +766,7 @@ public:
try
{
static_string<5> s2("123");
s2.insert(5, boost::string_ref("UV"));
s2.insert(5, string_view("UV"));
fail("", __FILE__, __LINE__);
}
catch(std::out_of_range const&)
@@ -1024,7 +1024,7 @@ public:
}
}
{
boost::string_ref s1("XYZ");
string_view s1("XYZ");
static_string<5> s2("12");
s2.append(s1);
BEAST_EXPECT(s2 == "12XYZ");
@@ -1124,7 +1124,7 @@ public:
}
}
{
boost::string_ref s1("34");
string_view s1("34");
static_string<4> s2("12");
s2 += s1;
BEAST_EXPECT(s2 == "1234");
+9
View File
@@ -0,0 +1,9 @@
//
// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Test that header file is self-contained.
#include <beast/core/string_view.hpp>