Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: tools/gn/xml_element_writer_unittest.cc

Issue 2813213002: Moved/renamed EscapeString from visual_studio_writer to XmlEscape in xml_element_writer. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gn/xml_element_writer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/xml_element_writer.h" 5 #include "tools/gn/xml_element_writer.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 TEST(XmlElementWriter, StartContent) { 79 TEST(XmlElementWriter, StartContent) {
80 std::ostringstream out; 80 std::ostringstream out;
81 { 81 {
82 XmlElementWriter writer(out, "foo", XmlAttributes("bar", "baz")); 82 XmlElementWriter writer(out, "foo", XmlAttributes("bar", "baz"));
83 writer.StartContent(false) << "Hello world!"; 83 writer.StartContent(false) << "Hello world!";
84 } 84 }
85 EXPECT_EQ("<foo bar=\"baz\">Hello world!</foo>\n", out.str()); 85 EXPECT_EQ("<foo bar=\"baz\">Hello world!</foo>\n", out.str());
86 } 86 }
87
88 TEST(XmlElementWriter, TestXmlEscape) {
89 std::string input = "\r \n \t & < > \"";
90 std::string output = XmlEscape(input);
91 std::string expected = "&#13; &#10; &#9; &amp; &lt; &gt; &quot;";
92 EXPECT_EQ(expected, output);
93 }
OLDNEW
« no previous file with comments | « tools/gn/xml_element_writer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698