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 {
61
61
_ = try src. lexNumber ( )
62
62
}
63
63
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
-
99
64
// TODO: want to dummy print out source ranges, etc, test that.
100
65
}
101
66
Original file line number Diff line number Diff line change @@ -2877,6 +2877,11 @@ extension RegexTests {
2877
2877
diagnosticTest ( #"[\d--\u{a b}]"# , . unsupported( " scalar sequence in custom character class " ) )
2878
2878
diagnosticTest ( #"[\d--[\u{a b}]]"# , . unsupported( " scalar sequence in custom character class " ) )
2879
2879
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
+
2880
2885
// MARK: Matching options
2881
2886
2882
2887
diagnosticTest ( #"(?^-"# , . cannotRemoveMatchingOptionsAfterCaret)
You can’t perform that action at this time.
0 commit comments