OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project 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 "src/char-predicates.h" | 5 #include "src/char-predicates.h" |
6 #include "src/unicode.h" | 6 #include "src/unicode.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 EXPECT_TRUE(IdentifierPart::Is(0x1369)); | 79 EXPECT_TRUE(IdentifierPart::Is(0x1369)); |
80 EXPECT_TRUE(IdentifierPart::Is(0x1370)); | 80 EXPECT_TRUE(IdentifierPart::Is(0x1370)); |
81 EXPECT_TRUE(IdentifierPart::Is(0x1371)); | 81 EXPECT_TRUE(IdentifierPart::Is(0x1371)); |
82 EXPECT_TRUE(IdentifierPart::Is(0x19DA)); | 82 EXPECT_TRUE(IdentifierPart::Is(0x19DA)); |
83 | 83 |
84 // Issue 2892: | 84 // Issue 2892: |
85 // \u2E2F has the Pattern_Syntax property, excluding it from ID_Start. | 85 // \u2E2F has the Pattern_Syntax property, excluding it from ID_Start. |
86 EXPECT_FALSE(IdentifierPart::Is(0x2E2F)); | 86 EXPECT_FALSE(IdentifierPart::Is(0x2E2F)); |
87 } | 87 } |
88 | 88 |
| 89 |
| 90 #ifdef V8_I18N_SUPPORT |
| 91 TEST(UnicodePredicatesTest, SupplementaryPlaneIdentifiers) { |
| 92 // Both ID_Start and ID_Continue. |
| 93 EXPECT_TRUE(IdentifierStart::Is(0x10403)); // Category Lu |
| 94 EXPECT_TRUE(IdentifierPart::Is(0x10403)); |
| 95 EXPECT_TRUE(IdentifierStart::Is(0x1043C)); // Category Ll |
| 96 EXPECT_TRUE(IdentifierPart::Is(0x1043C)); |
| 97 EXPECT_TRUE(IdentifierStart::Is(0x16F9C)); // Category Lm |
| 98 EXPECT_TRUE(IdentifierPart::Is(0x16F9C)); |
| 99 EXPECT_TRUE(IdentifierStart::Is(0x10048)); // Category Lo |
| 100 EXPECT_TRUE(IdentifierPart::Is(0x10048)); |
| 101 EXPECT_TRUE(IdentifierStart::Is(0x1014D)); // Category Nl |
| 102 EXPECT_TRUE(IdentifierPart::Is(0x1014D)); |
| 103 |
| 104 // Only ID_Continue. |
| 105 EXPECT_FALSE(IdentifierStart::Is(0x101FD)); // Category Mn |
| 106 EXPECT_TRUE(IdentifierPart::Is(0x101FD)); |
| 107 EXPECT_FALSE(IdentifierStart::Is(0x11002)); // Category Mc |
| 108 EXPECT_TRUE(IdentifierPart::Is(0x11002)); |
| 109 EXPECT_FALSE(IdentifierStart::Is(0x104A9)); // Category Nd |
| 110 EXPECT_TRUE(IdentifierPart::Is(0x104A9)); |
| 111 |
| 112 // Neither. |
| 113 EXPECT_FALSE(IdentifierStart::Is(0x10111)); // Category No |
| 114 EXPECT_FALSE(IdentifierPart::Is(0x10111)); |
| 115 EXPECT_FALSE(IdentifierStart::Is(0x1F4A9)); // Category So |
| 116 EXPECT_FALSE(IdentifierPart::Is(0x1F4A9)); |
| 117 } |
| 118 #endif // V8_I18N_SUPPORT |
| 119 |
89 } // namespace internal | 120 } // namespace internal |
90 } // namespace v8 | 121 } // namespace v8 |
OLD | NEW |