@@ -503,6 +503,8 @@ extension RegexTests {
503503 parseTest ( " [-a-] " , charClass ( " - " , " a " , " - " ) )
504504
505505 parseTest ( " [a-z] " , charClass ( range_m ( " a " , " z " ) ) )
506+ parseTest ( " [a-a] " , charClass ( range_m ( " a " , " a " ) ) )
507+ parseTest ( " [B-a] " , charClass ( range_m ( " B " , " a " ) ) )
506508
507509 // FIXME: AST builder helpers for custom char class types
508510 parseTest ( " [a-d--a-c] " , charClass (
@@ -2442,6 +2444,11 @@ extension RegexTests {
24422444
24432445 diagnosticTest ( #"|([\d-c])?"# , . invalidCharacterClassRangeOperand)
24442446
2447+ diagnosticTest ( #"[_-A]"# , . invalidCharacterRange( from: " _ " , to: " A " ) )
2448+ diagnosticTest ( #"(?i)[_-A]"# , . invalidCharacterRange( from: " _ " , to: " A " ) )
2449+ diagnosticTest ( #"[c-b]"# , . invalidCharacterRange( from: " c " , to: " b " ) )
2450+ diagnosticTest ( #"[\u{66}-\u{65}]"# , . invalidCharacterRange( from: " \u{66} " , to: " \u{65} " ) )
2451+
24452452 // MARK: Bad escapes
24462453
24472454 diagnosticTest ( " \\ " , . expectedEscape)
@@ -2555,6 +2562,17 @@ extension RegexTests {
25552562 diagnosticTest ( " {1,3} " , . quantifierRequiresOperand( " {1,3} " ) )
25562563 diagnosticTest ( " a{3,2} " , . invalidQuantifierRange( 3 , 2 ) )
25572564
2565+ // These are not quantifiable.
2566+ diagnosticTest ( #"\b?"# , . notQuantifiable)
2567+ diagnosticTest ( #"\B*"# , . notQuantifiable)
2568+ diagnosticTest ( #"\A+"# , . notQuantifiable)
2569+ diagnosticTest ( #"\Z??"# , . notQuantifiable)
2570+ diagnosticTest ( #"\G*?"# , . notQuantifiable)
2571+ diagnosticTest ( #"\z+?"# , . notQuantifiable)
2572+ diagnosticTest ( #"\K{1}"# , . unsupported( #"'\K'"# ) )
2573+ diagnosticTest ( #"\y{2,5}"# , . notQuantifiable)
2574+ diagnosticTest ( #"\Y{3,}"# , . notQuantifiable)
2575+
25582576 // MARK: Unicode scalars
25592577
25602578 diagnosticTest ( #"\u{G}"# , . expectedNumber( " G " , kind: . hex) )
@@ -2641,13 +2659,13 @@ extension RegexTests {
26412659
26422660 diagnosticTest ( " (*MARK) " , . backtrackingDirectiveMustHaveName( " MARK " ) )
26432661 diagnosticTest ( " (*:) " , . expectedNonEmptyContents)
2644- diagnosticTest ( " (*MARK:a)? " , . notQuantifiable )
2645- diagnosticTest ( " (*FAIL)+ " , . notQuantifiable )
2646- diagnosticTest ( " (*COMMIT:b)* " , . notQuantifiable )
2647- diagnosticTest ( " (*PRUNE:a)?? " , . notQuantifiable )
2648- diagnosticTest ( " (*SKIP:a)*? " , . notQuantifiable )
2649- diagnosticTest ( " (*F)+? " , . notQuantifiable )
2650- diagnosticTest ( " (*:a){2} " , . notQuantifiable )
2662+ diagnosticTest ( " (*MARK:a)? " , . unsupported ( " backtracking directive " ) )
2663+ diagnosticTest ( " (*FAIL)+ " , . unsupported ( " backtracking directive " ) )
2664+ diagnosticTest ( " (*COMMIT:b)* " , . unsupported ( " backtracking directive " ) )
2665+ diagnosticTest ( " (*PRUNE:a)?? " , . unsupported ( " backtracking directive " ) )
2666+ diagnosticTest ( " (*SKIP:a)*? " , . unsupported ( " backtracking directive " ) )
2667+ diagnosticTest ( " (*F)+? " , . unsupported ( " backtracking directive " ) )
2668+ diagnosticTest ( " (*:a){2} " , . unsupported ( " backtracking directive " ) )
26512669
26522670 // MARK: Oniguruma absent functions
26532671
0 commit comments