summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-11-13 14:04:17 +0000
committerAlexander Kornienko <alexfh@google.com>2013-11-13 14:04:17 +0000
commit393e3088a1fab513490cbb759a312a0ee94a5be9 (patch)
treedad16ff91dfb7474ddcb36ebf79cfd6bc3067867 /clang/unittests/Format/FormatTest.cpp
parentfdc88137f4882850a3b31b686ca9b63cb2ab6a48 (diff)
downloadbcm5719-llvm-393e3088a1fab513490cbb759a312a0ee94a5be9.tar.gz
bcm5719-llvm-393e3088a1fab513490cbb759a312a0ee94a5be9.zip
Correctly mark first token in the presence of UTF-8 BOM.
Summary: Fixes http://llvm.org/PR17753 Reviewers: klimek Reviewed By: klimek CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D2159 llvm-svn: 194576
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index f2ac3ba94fb..b6574c7503a 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -6911,6 +6911,14 @@ TEST_F(FormatTest, WorksFor8bitEncodings) {
getLLVMStyleWithColumns(12)));
}
+TEST_F(FormatTest, HandlesUTF8BOM) {
+ EXPECT_EQ("\xef\xbb\xbf", format("\xef\xbb\xbf"));
+ EXPECT_EQ("\xef\xbb\xbf#include <iostream>",
+ format("\xef\xbb\xbf#include <iostream>"));
+ EXPECT_EQ("\xef\xbb\xbf\n#include <iostream>",
+ format("\xef\xbb\xbf\n#include <iostream>"));
+}
+
// FIXME: Encode Cyrillic and CJK characters below to appease MS compilers.
#if !defined(_MSC_VER)
OpenPOWER on IntegriCloud