summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/LocaleTest.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-08-08 01:10:50 +0000
committerAlexander Kornienko <alexfh@google.com>2013-08-08 01:10:50 +0000
commit05e1786db6044fcfe5d3843b65e165c592bd4dd3 (patch)
tree5e62cad77e9d069b9a9a05997ac580ef1457b8f4 /llvm/unittests/Support/LocaleTest.cpp
parent178a8df66006a507e8553f174904753539b54bb1 (diff)
downloadbcm5719-llvm-05e1786db6044fcfe5d3843b65e165c592bd4dd3.tar.gz
bcm5719-llvm-05e1786db6044fcfe5d3843b65e165c592bd4dd3.zip
Changed isPrint for U+00AD SOFT HYPHEN to return true.
Summary: This is consistent with MacOSX implementation, and most terminals actually display this character (checked on gnome-terminal, lxterminal, lxterm, Terminal.app, iterm2). Actually, this is in line with the ISO Latin 1 standard (ISO 8859-1), which defines it differently from the Unicode Standard. More information here: http://www.cs.tut.fi/~jkorpela/shy.html Reviewers: gribozavr, jordan_rose CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1310 llvm-svn: 187949
Diffstat (limited to 'llvm/unittests/Support/LocaleTest.cpp')
-rw-r--r--llvm/unittests/Support/LocaleTest.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/unittests/Support/LocaleTest.cpp b/llvm/unittests/Support/LocaleTest.cpp
index 3524b4b7952..ad90bdf9f54 100644
--- a/llvm/unittests/Support/LocaleTest.cpp
+++ b/llvm/unittests/Support/LocaleTest.cpp
@@ -32,6 +32,12 @@ TEST(Locale, columnWidth) {
EXPECT_EQ(-1, columnWidth("aaaaaaaaaa\x01"));
EXPECT_EQ(-1, columnWidth("\342\200\213")); // 200B ZERO WIDTH SPACE
+ // 00AD SOFT HYPHEN is displayed on most terminals as a space or a dash. Some
+ // text editors display it only when a line is broken at it, some use it as a
+ // line-break hint, but don't display. We choose terminal-oriented
+ // interpretation.
+ EXPECT_EQ(1, columnWidth("\302\255"));
+
EXPECT_EQ(0, columnWidth("\314\200")); // 0300 COMBINING GRAVE ACCENT
EXPECT_EQ(1, columnWidth("\340\270\201")); // 0E01 THAI CHARACTER KO KAI
EXPECT_EQ(2, columnWidth("\344\270\200")); // CJK UNIFIED IDEOGRAPH-4E00
@@ -72,10 +78,8 @@ TEST(Locale, isPrint) {
EXPECT_EQ(false, isPrint(0x9F));
EXPECT_EQ(true, isPrint(0xAC));
- // FIXME: Figure out if we want to treat SOFT HYPHEN as printable character.
-#ifndef __APPLE__
- EXPECT_EQ(false, isPrint(0xAD)); // SOFT HYPHEN
-#endif // __APPLE__
+ EXPECT_EQ(true, isPrint(0xAD)); // SOFT HYPHEN is displayed on most terminals
+ // as either a space or a dash.
EXPECT_EQ(true, isPrint(0xAE));
// MacOS implementation doesn't think it's printable.
OpenPOWER on IntegriCloud