Remove duplicate code in this header file which seemed to undergo a copy/paste fiasco.
[oota-llvm.git] / unittests / Support / raw_ostream_test.cpp
index bd2e95cbb531418b7e9fb46fa4fe127497ae9432..2b797b43666bac648e573cbaadbf77833c4b5027 100644 (file)
@@ -127,4 +127,20 @@ TEST(raw_ostreamTest, TinyBuffer) {
   EXPECT_EQ("hello1world", OS.str());
 }
 
+TEST(raw_ostreamTest, WriteEscaped) {
+  std::string Str;
+
+  Str = "";
+  raw_string_ostream(Str).write_escaped("hi");
+  EXPECT_EQ("hi", Str);
+
+  Str = "";
+  raw_string_ostream(Str).write_escaped("\\\t\n\"");
+  EXPECT_EQ("\\\\\\t\\n\\\"", Str);
+
+  Str = "";
+  raw_string_ostream(Str).write_escaped("\1\10\200");
+  EXPECT_EQ("\\001\\010\\200", Str);
+}
+
 }