File tree Expand file tree Collapse file tree 2 files changed +5
-35
lines changed Expand file tree Collapse file tree 2 files changed +5
-35
lines changed Original file line number Diff line number Diff line change @@ -61,41 +61,6 @@ extension RegexTests {
6161 _ = try src. lexNumber ( )
6262 }
6363
64- func diagnoseUniScalarOverflow( _ input: String , base: Character ) {
65- let scalars = input. first == " { "
66- ? String ( input. dropFirst ( ) . dropLast ( ) )
67- : input
68- diagnose (
69- input,
70- expecting: . numberOverflow( scalars)
71- ) { src in
72- _ = try src. expectUnicodeScalar ( escapedCharacter: base)
73- }
74- }
75- func diagnoseUniScalar(
76- _ input: String ,
77- base: Character ,
78- expectedDigits numDigits: Int
79- ) {
80- let scalars = input. first == " { "
81- ? String ( input. dropFirst ( ) . dropLast ( ) )
82- : input
83- diagnose (
84- input,
85- expecting: . expectedNumDigits( scalars, numDigits)
86- ) { src in
87- _ = try src. expectUnicodeScalar ( escapedCharacter: base)
88- }
89- _ = scalars
90- }
91-
92- diagnoseUniScalar (
93- " 12 " , base: " u " , expectedDigits: 4 )
94- diagnoseUniScalar (
95- " 12 " , base: " U " , expectedDigits: 8 )
96- diagnoseUniScalarOverflow ( " {123456789} " , base: " u " )
97- diagnoseUniScalarOverflow ( " {123456789} " , base: " x " )
98-
9964 // TODO: want to dummy print out source ranges, etc, test that.
10065 }
10166
Original file line number Diff line number Diff line change @@ -2877,6 +2877,11 @@ extension RegexTests {
28772877 diagnosticTest ( #"[\d--\u{a b}]"# , . unsupported( " scalar sequence in custom character class " ) )
28782878 diagnosticTest ( #"[\d--[\u{a b}]]"# , . unsupported( " scalar sequence in custom character class " ) )
28792879
2880+ diagnosticTest ( #"\u12"# , . expectedNumDigits( " 12 " , 4 ) )
2881+ diagnosticTest ( #"\U12"# , . expectedNumDigits( " 12 " , 8 ) )
2882+ diagnosticTest ( #"\u{123456789}"# , . numberOverflow( " 123456789 " ) )
2883+ diagnosticTest ( #"\x{123456789}"# , . numberOverflow( " 123456789 " ) )
2884+
28802885 // MARK: Matching options
28812886
28822887 diagnosticTest ( #"(?^-"# , . cannotRemoveMatchingOptionsAfterCaret)
You can’t perform that action at this time.
0 commit comments