Index: test/unittests/char-predicates-unittest.cc |
diff --git a/test/unittests/char-predicates-unittest.cc b/test/unittests/char-predicates-unittest.cc |
index a34e3a168008e6546d28de7f1ec2ef71f8abe76d..3c6cf5d6a6f897c82dcf63e13a9674ed9055607e 100644 |
--- a/test/unittests/char-predicates-unittest.cc |
+++ b/test/unittests/char-predicates-unittest.cc |
@@ -10,32 +10,40 @@ namespace v8 { |
namespace internal { |
TEST(CharPredicatesTest, WhiteSpace) { |
- // As of Unicode 6.3.0, \u180E is no longer a white space. We still consider |
- // it to be one though, since JS recognizes all white spaces in Unicode 5.1. |
EXPECT_TRUE(WhiteSpace::Is(0x0009)); |
EXPECT_TRUE(WhiteSpace::Is(0x000B)); |
EXPECT_TRUE(WhiteSpace::Is(0x000C)); |
EXPECT_TRUE(WhiteSpace::Is(' ')); |
EXPECT_TRUE(WhiteSpace::Is(0x00A0)); |
+ EXPECT_TRUE(WhiteSpace::Is(0x1680)); |
+ EXPECT_TRUE(WhiteSpace::Is(0x2000)); |
+ EXPECT_TRUE(WhiteSpace::Is(0x2007)); |
+ EXPECT_TRUE(WhiteSpace::Is(0x202F)); |
+ EXPECT_TRUE(WhiteSpace::Is(0x205F)); |
+ EXPECT_TRUE(WhiteSpace::Is(0x3000)); |
EXPECT_TRUE(WhiteSpace::Is(0xFEFF)); |
+ EXPECT_FALSE(WhiteSpace::Is(0x180E)); |
} |
TEST(CharPredicatesTest, WhiteSpaceOrLineTerminator) { |
- // As of Unicode 6.3.0, \u180E is no longer a white space. We still consider |
- // it to be one though, since JS recognizes all white spaces in Unicode 5.1. |
- // White spaces |
EXPECT_TRUE(WhiteSpaceOrLineTerminator::Is(0x0009)); |
EXPECT_TRUE(WhiteSpaceOrLineTerminator::Is(0x000B)); |
EXPECT_TRUE(WhiteSpaceOrLineTerminator::Is(0x000C)); |
EXPECT_TRUE(WhiteSpaceOrLineTerminator::Is(' ')); |
EXPECT_TRUE(WhiteSpaceOrLineTerminator::Is(0x00A0)); |
+ EXPECT_TRUE(WhiteSpaceOrLineTerminator::Is(0x1680)); |
+ EXPECT_TRUE(WhiteSpaceOrLineTerminator::Is(0x2000)); |
+ EXPECT_TRUE(WhiteSpaceOrLineTerminator::Is(0x2007)); |
+ EXPECT_TRUE(WhiteSpaceOrLineTerminator::Is(0x202F)); |
+ EXPECT_TRUE(WhiteSpaceOrLineTerminator::Is(0x205F)); |
EXPECT_TRUE(WhiteSpaceOrLineTerminator::Is(0xFEFF)); |
// Line terminators |
EXPECT_TRUE(WhiteSpaceOrLineTerminator::Is(0x000A)); |
EXPECT_TRUE(WhiteSpaceOrLineTerminator::Is(0x000D)); |
EXPECT_TRUE(WhiteSpaceOrLineTerminator::Is(0x2028)); |
EXPECT_TRUE(WhiteSpaceOrLineTerminator::Is(0x2029)); |
+ EXPECT_FALSE(WhiteSpaceOrLineTerminator::Is(0x180E)); |
} |
@@ -45,7 +53,11 @@ TEST(CharPredicatesTest, IdentifierStart) { |
EXPECT_TRUE(IdentifierStart::Is('\\')); |
// http://www.unicode.org/reports/tr31/ |
+ // curl http://www.unicode.org/Public/UCD/latest/ucd/PropList.txt | |
+ // grep 'Other_ID_Start' |
// Other_ID_Start |
+ EXPECT_TRUE(IdentifierStart::Is(0x1885)); |
+ EXPECT_TRUE(IdentifierStart::Is(0x1886)); |
EXPECT_TRUE(IdentifierStart::Is(0x2118)); |
EXPECT_TRUE(IdentifierStart::Is(0x212E)); |
EXPECT_TRUE(IdentifierStart::Is(0x309B)); |
@@ -53,7 +65,27 @@ TEST(CharPredicatesTest, IdentifierStart) { |
// Issue 2892: |
// \u2E2F has the Pattern_Syntax property, excluding it from ID_Start. |
- EXPECT_FALSE(unibrow::ID_Start::Is(0x2E2F)); |
+ EXPECT_FALSE(IdentifierStart::Is(0x2E2F)); |
+ |
+#ifdef V8_INTL_SUPPORT |
+ // New in Unicode 8.0 (6,847 code points) |
+ // [:ID_Start:] & [[:Age=8.0:] - [:Age=7.0:]] |
+ EXPECT_TRUE(IdentifierStart::Is(0x08B3)); |
+ EXPECT_TRUE(IdentifierStart::Is(0x0AF9)); |
+ EXPECT_TRUE(IdentifierStart::Is(0x13F8)); |
+ EXPECT_TRUE(IdentifierStart::Is(0x9FCD)); |
+ EXPECT_TRUE(IdentifierStart::Is(0xAB60)); |
+ EXPECT_TRUE(IdentifierStart::Is(0x10CC0)); |
+ EXPECT_TRUE(IdentifierStart::Is(0x108E0)); |
+ EXPECT_TRUE(IdentifierStart::Is(0x2B820)); |
+ |
+ // New in Unicode 9.0 (7,177 code points) |
+ // [:ID_Start:] & [[:Age=9.0:] - [:Age=8.0:]] |
+ |
+ EXPECT_TRUE(IdentifierStart::Is(0x1C80)); |
+ EXPECT_TRUE(IdentifierStart::Is(0x104DB)); |
+ EXPECT_TRUE(IdentifierStart::Is(0x1E922)); |
+#endif |
} |
@@ -64,8 +96,45 @@ TEST(CharPredicatesTest, IdentifierPart) { |
EXPECT_TRUE(IdentifierPart::Is(0x200C)); |
EXPECT_TRUE(IdentifierPart::Is(0x200D)); |
+#ifdef V8_INTL_SUPPORT |
+ // New in Unicode 8.0 (6,847 code points) |
+ // [:ID_Start:] & [[:Age=8.0:] - [:Age=7.0:]] |
+ EXPECT_TRUE(IdentifierPart::Is(0x08B3)); |
+ EXPECT_TRUE(IdentifierPart::Is(0x0AF9)); |
+ EXPECT_TRUE(IdentifierPart::Is(0x13F8)); |
+ EXPECT_TRUE(IdentifierPart::Is(0x9FCD)); |
+ EXPECT_TRUE(IdentifierPart::Is(0xAB60)); |
+ EXPECT_TRUE(IdentifierPart::Is(0x10CC0)); |
+ EXPECT_TRUE(IdentifierPart::Is(0x108E0)); |
+ EXPECT_TRUE(IdentifierPart::Is(0x2B820)); |
+ |
+ // [[:ID_Continue:]-[:ID_Start:]] & [[:Age=8.0:]-[:Age=7.0:]] |
+ // 162 code points |
+ EXPECT_TRUE(IdentifierPart::Is(0x08E3)); |
+ EXPECT_TRUE(IdentifierPart::Is(0xA69E)); |
+ EXPECT_TRUE(IdentifierPart::Is(0x11730)); |
+ |
+ // New in Unicode 9.0 (7,177 code points) |
+ // [:ID_Start:] & [[:Age=9.0:] - [:Age=8.0:]] |
+ EXPECT_TRUE(IdentifierPart::Is(0x1C80)); |
+ EXPECT_TRUE(IdentifierPart::Is(0x104DB)); |
+ EXPECT_TRUE(IdentifierPart::Is(0x1E922)); |
+ |
+ // [[:ID_Continue:]-[:ID_Start:]] & [[:Age=9.0:]-[:Age=8.0:]] |
+ // 162 code points |
+ EXPECT_TRUE(IdentifierPart::Is(0x08D4)); |
+ EXPECT_TRUE(IdentifierPart::Is(0x1DFB)); |
+ EXPECT_TRUE(IdentifierPart::Is(0xA8C5)); |
+ EXPECT_TRUE(IdentifierPart::Is(0x11450)); |
+#endif |
+ |
// http://www.unicode.org/reports/tr31/ |
+ // curl http://www.unicode.org/Public/UCD/latest/ucd/PropList.txt | |
+ // grep 'Other_ID_(Continue|Start)' |
+ |
// Other_ID_Start |
+ EXPECT_TRUE(IdentifierPart::Is(0x1885)); |
+ EXPECT_TRUE(IdentifierPart::Is(0x1886)); |
EXPECT_TRUE(IdentifierPart::Is(0x2118)); |
EXPECT_TRUE(IdentifierPart::Is(0x212E)); |
EXPECT_TRUE(IdentifierPart::Is(0x309B)); |
@@ -98,6 +167,11 @@ TEST(CharPredicatesTest, SupplementaryPlaneIdentifiers) { |
EXPECT_TRUE(IdentifierStart::Is(0x1014D)); // Category Nl |
EXPECT_TRUE(IdentifierPart::Is(0x1014D)); |
+ // New in Unicode 8.0 |
+ // [ [:ID_Start=Yes:] & [:Age=8.0:]] - [:Age=7.0:] |
+ EXPECT_TRUE(IdentifierStart::Is(0x108E0)); |
+ EXPECT_TRUE(IdentifierStart::Is(0x10C80)); |
+ |
// Only ID_Continue. |
EXPECT_FALSE(IdentifierStart::Is(0x101FD)); // Category Mn |
EXPECT_TRUE(IdentifierPart::Is(0x101FD)); |