@@ -837,6 +837,23 @@ extension RegexTests {
837
837
var eComposed : String { " é " }
838
838
var eDecomposed : String { " e \u{301} " }
839
839
840
+ func testIndividualScalars( ) {
841
+ matchTest ( #"\u{65}\u{301}$"# , input: eDecomposed, match: eDecomposed)
842
+
843
+ matchTest ( #"\u{65}"# , input: eDecomposed, match: " e " )
844
+ matchTest ( #"\u{65}$"# , input: eDecomposed, match: nil )
845
+ // FIXME: \y is unsupported
846
+ matchTest ( #"\u{65}\y"# , input: eDecomposed, match: nil ,
847
+ xfail: true )
848
+
849
+ // FIXME: Unicode scalars are only matched at the start of a grapheme cluster
850
+ matchTest ( #"\u{301}"# , input: eDecomposed, match: " \u{301} " ,
851
+ xfail: true )
852
+ // FIXME: \y is unsupported
853
+ matchTest ( #"\y\u{301}"# , input: eDecomposed, match: nil ,
854
+ xfail: true )
855
+ }
856
+
840
857
func testCanonicalEquivalence( ) throws {
841
858
// Expectation: Matching should use canonical equivalence whenever comparing
842
859
// characters, so a user can write characters using any equivalent spelling
@@ -846,20 +863,22 @@ extension RegexTests {
846
863
#"é$"# ,
847
864
( eComposed, eComposed) ,
848
865
( eDecomposed, eDecomposed) )
849
-
866
+
850
867
// FIXME: Decomposed character in regex literal doesn't match an equivalent character
851
868
matchTests (
852
869
#"e\u{301}$"# ,
853
870
( eComposed, eComposed) ,
854
871
( eDecomposed, eDecomposed) ,
855
872
xfail: true )
856
-
873
+ matchTest ( #"\u{65}\u{301}$"# , input: eComposed, match: eComposed,
874
+ xfail: true )
875
+
857
876
matchTests (
858
877
#"e$"# ,
859
878
( eComposed, nil ) ,
860
879
( eDecomposed, nil ) )
861
880
}
862
-
881
+
863
882
func testCanonicalEquivalenceCharacterClass( ) throws {
864
883
// Expectation: Character classes should match equivalent characters to the
865
884
// same degree, regardless of how they are spelled. Unicode "property
@@ -980,8 +999,7 @@ extension RegexTests {
980
999
xfail: true )
981
1000
matchTest ( #"e\O"# , input: eDecomposed, match: eDecomposed,
982
1001
xfail: true )
983
- // TODO: Should these two match or not?
984
- matchTest ( #"\O\u{301}"# , input: eComposed, match: eComposed,
1002
+ matchTest ( #"\O\u{301}"# , input: eComposed, match: nil ,
985
1003
xfail: true )
986
1004
matchTest ( #"e\O"# , input: eComposed, match: nil ,
987
1005
xfail: true )
0 commit comments