From 37046938dae87e99fddbc73573fae32c683c616d Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Tue, 9 May 2017 11:36:48 +0300 Subject: [tidy] modernize-raw-string-literal --- include/mbgl/style/conversion/filter.hpp | 2 +- include/mbgl/style/conversion/function.hpp | 2 +- platform/glfw/main.cpp | 2 +- test/src/mbgl/test/fixture_log_observer.cpp | 6 +++--- test/style/conversion/function.test.cpp | 14 +++++++------- test/style/conversion/light.test.cpp | 14 +++++++------- test/style/filter.test.cpp | 8 ++++---- test/style/source.test.cpp | 2 +- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/mbgl/style/conversion/filter.hpp b/include/mbgl/style/conversion/filter.hpp index 1f8f0fd161..986d1bf80d 100644 --- a/include/mbgl/style/conversion/filter.hpp +++ b/include/mbgl/style/conversion/filter.hpp @@ -57,7 +57,7 @@ public: return convertUnaryFilter(value, error); } - error = { "filter operator must be one of \"==\", \"!=\", \">\", \">=\", \"<\", \"<=\", \"in\", \"!in\", \"all\", \"any\", \"none\", \"has\", or \"!has\"" }; + error = { R"(filter operator must be one of "==", "!=", ">", ">=", "<", "<=", "in", "!in", "all", "any", "none", "has", or "!has")" }; return {}; } diff --git a/include/mbgl/style/conversion/function.hpp b/include/mbgl/style/conversion/function.hpp index fa8af1e2be..bf5b27a9a6 100644 --- a/include/mbgl/style/conversion/function.hpp +++ b/include/mbgl/style/conversion/function.hpp @@ -218,7 +218,7 @@ optional> convertDefaultValue(const V& value, Error& error) { auto defaultValue = convert(*defaultValueValue, error); if (!defaultValue) { - error = { "wrong type for \"default\": " + error.message }; + error = { R"(wrong type for "default": )" + error.message }; return {}; } diff --git a/platform/glfw/main.cpp b/platform/glfw/main.cpp index e95a15a55b..ef8ad91544 100644 --- a/platform/glfw/main.cpp +++ b/platform/glfw/main.cpp @@ -194,7 +194,7 @@ int main(int argc, char *argv[]) { settings.save(); } mbgl::Log::Info(mbgl::Event::General, - "Exit location: --lat=\"%f\" --lon=\"%f\" --zoom=\"%f\" --bearing \"%f\"", + R"(Exit location: --lat="%f" --lon="%f" --zoom="%f" --bearing "%f")", settings.latitude, settings.longitude, settings.zoom, settings.bearing); view = nullptr; diff --git a/test/src/mbgl/test/fixture_log_observer.cpp b/test/src/mbgl/test/fixture_log_observer.cpp index db257d73cf..717d2da753 100644 --- a/test/src/mbgl/test/fixture_log_observer.cpp +++ b/test/src/mbgl/test/fixture_log_observer.cpp @@ -94,10 +94,10 @@ std::vector FixtureLogObserver::unchecked() const { } ::std::ostream& operator<<(::std::ostream& os, const FixtureLog::Message& message) { - os << "[\"" << Enum::toString(message.severity) << "\", \""; - os << Enum::toString(message.event) << "\""; + os << R"([")" << Enum::toString(message.severity) << R"(", ")"; + os << Enum::toString(message.event) << R"(")"; os << ", " << message.code; - os << ", \"" << message.msg << "\""; + os << R"(, ")" << message.msg << R"(")"; return os << "]" << std::endl; } diff --git a/test/style/conversion/function.test.cpp b/test/style/conversion/function.test.cpp index 08637d40cb..1eff94d939 100644 --- a/test/style/conversion/function.test.cpp +++ b/test/style/conversion/function.test.cpp @@ -19,26 +19,26 @@ TEST(StyleConversion, Function) { return convert, JSValue>(doc, error); }; - auto fn1 = parseFunction("{\"stops\":[]}"); + auto fn1 = parseFunction(R"({"stops":[]})"); ASSERT_FALSE(fn1); ASSERT_EQ("function must have at least one stop", error.message); - auto fn2 = parseFunction("{\"stops\":[1]}"); + auto fn2 = parseFunction(R"({"stops":[1]})"); ASSERT_FALSE(fn2); ASSERT_EQ("function stop must be an array", error.message); - auto fn3 = parseFunction("{\"stops\":[[]]}"); + auto fn3 = parseFunction(R"({"stops":[[]]})"); ASSERT_FALSE(fn3); ASSERT_EQ("function stop must have two elements", error.message); - auto fn4 = parseFunction("{\"stops\":[[-1,-1]]}"); + auto fn4 = parseFunction(R"({"stops":[[-1,-1]]})"); ASSERT_TRUE(bool(fn4)); - auto fn5 = parseFunction("{\"stops\":[[0,1,2]]}"); + auto fn5 = parseFunction(R"({"stops":[[0,1,2]]})"); ASSERT_FALSE(fn5); ASSERT_EQ("function stop must have two elements", error.message); - auto fn6 = parseFunction("{\"stops\":[[0,\"x\"]]}"); + auto fn6 = parseFunction(R"({"stops":[[0,"x"]]})"); ASSERT_FALSE(fn6); ASSERT_EQ("value must be a number", error.message); @@ -50,7 +50,7 @@ TEST(StyleConversion, Function) { ASSERT_FALSE(fn8); ASSERT_EQ("function must be an object", error.message); - auto fn9 = parseFunction("{\"stops\":[[0,0]],\"base\":false}"); + auto fn9 = parseFunction(R"({"stops":[[0,0]],"base":false})"); ASSERT_FALSE(fn9); ASSERT_EQ("function base must be a number", error.message); } diff --git a/test/style/conversion/light.test.cpp b/test/style/conversion/light.test.cpp index a2185906d6..28e22b3550 100644 --- a/test/style/conversion/light.test.cpp +++ b/test/style/conversion/light.test.cpp @@ -30,7 +30,7 @@ TEST(StyleConversion, Light) { } { - auto light = parseLight("{\"color\":{\"stops\":[[14,\"blue\"],[16,\"red\"]]},\"intensity\":0.3,\"position\":[3,90,90]}"); + auto light = parseLight(R"({"color":{"stops":[[14,"blue"],[16,"red"]]},"intensity":0.3,"position":[3,90,90]})"); ASSERT_TRUE((bool) light); ASSERT_TRUE(light->getAnchor().isUndefined()); @@ -54,7 +54,7 @@ TEST(StyleConversion, Light) { } { - auto light = parseLight("{\"color\":\"blue\",\"intensity\":0.3,\"color-transition\":{\"duration\":1000}}"); + auto light = parseLight(R"({"color":"blue","intensity":0.3,"color-transition":{"duration":1000}})"); ASSERT_TRUE((bool) light); ASSERT_FALSE(light->getColor().isUndefined()); @@ -65,35 +65,35 @@ TEST(StyleConversion, Light) { } { - auto light = parseLight("{\"intensity\":false}"); + auto light = parseLight(R"({"intensity":false})"); ASSERT_FALSE((bool) light); ASSERT_EQ("value must be a number", error.message); } { - auto light = parseLight("{\"intensity\":{\"stops\":[[15,\"red\"],[17,\"blue\"]]}}"); + auto light = parseLight(R"({"intensity":{"stops":[[15,"red"],[17,"blue"]]}})"); ASSERT_FALSE((bool) light); ASSERT_EQ("value must be a number", error.message); } { - auto light = parseLight("{\"color\":5}"); + auto light = parseLight(R"({"color":5})"); ASSERT_FALSE((bool) light); ASSERT_EQ("value must be a string", error.message); } { - auto light = parseLight("{\"position\":[0,5]}"); + auto light = parseLight(R"({"position":[0,5]})"); ASSERT_FALSE((bool) light); ASSERT_EQ("value must be an array of 3 numbers", error.message); } { - auto light = parseLight("{\"anchor\":\"something\"}"); + auto light = parseLight(R"({"anchor":"something"})"); ASSERT_FALSE((bool) light); ASSERT_EQ("value must be a valid enumeration value", error.message); diff --git a/test/style/filter.test.cpp b/test/style/filter.test.cpp index c70792d8ef..96de125945 100644 --- a/test/style/filter.test.cpp +++ b/test/style/filter.test.cpp @@ -29,13 +29,13 @@ Feature feature(const PropertyMap& properties, const Geometry& geometry } TEST(Filter, EqualsString) { - Filter f = parse("[\"==\", \"foo\", \"bar\"]"); + Filter f = parse(R"(["==", "foo", "bar"])"); ASSERT_TRUE(f(feature({{ "foo", std::string("bar") }}))); ASSERT_FALSE(f(feature({{ "foo", std::string("baz") }}))); } TEST(Filter, EqualsNumber) { - Filter f = parse("[\"==\", \"foo\", 0]"); + Filter f = parse(R"(["==", "foo", 0])"); ASSERT_TRUE(f(feature({{ "foo", int64_t(0) }}))); ASSERT_TRUE(f(feature({{ "foo", uint64_t(0) }}))); ASSERT_TRUE(f(feature({{ "foo", double(0) }}))); @@ -50,13 +50,13 @@ TEST(Filter, EqualsNumber) { } TEST(Filter, EqualsType) { - Filter f = parse("[\"==\", \"$type\", \"LineString\"]"); + Filter f = parse(R"(["==", "$type", "LineString"])"); ASSERT_FALSE(f(feature({{}}, Point()))); ASSERT_TRUE(f(feature({{}}, LineString()))); } TEST(Filter, InType) { - Filter f = parse("[\"in\", \"$type\", \"LineString\", \"Polygon\"]"); + Filter f = parse(R"(["in", "$type", "LineString", "Polygon"])"); ASSERT_FALSE(f(feature({{}}, Point()))); ASSERT_TRUE(f(feature({{}}, LineString()))); ASSERT_TRUE(f(feature({{}}, Polygon()))); diff --git a/test/style/source.test.cpp b/test/style/source.test.cpp index c60a473589..9c0d914543 100644 --- a/test/style/source.test.cpp +++ b/test/style/source.test.cpp @@ -413,7 +413,7 @@ TEST(Source, GeoJSonSourceUrlUpdate) { test.fileSource.sourceResponse = [&] (const Resource& resource) { EXPECT_EQ("url", resource.url); Response response; - response.data = std::make_unique("{\"geometry\": {\"type\": \"Point\", \"coordinates\": [1.1, 1.1]}, \"type\": \"Feature\", \"properties\": {}}"); + response.data = std::make_unique(R"({"geometry": {"type": "Point", "coordinates": [1.1, 1.1]}, "type": "Feature", "properties": {}})"); return response; }; -- cgit v1.2.1