Swift: Additional test cases.

This commit is contained in:
Geoffrey White
2023-07-13 17:29:16 +01:00
parent fcc98f83c0
commit 2b9d25b317
2 changed files with 57 additions and 0 deletions

View File

@@ -6549,3 +6549,53 @@ regex.swift:
# 221| [RegExpStar] .*
#-----| 0 -> [RegExpDot] .
# 227| [RegExpGroup] (?i-s)
#-----| 0 -> [RegExpConstant, RegExpNormalChar] i-s
# 227| [RegExpSequence] (?i-s)abc
#-----| 0 -> [RegExpGroup] (?i-s)
#-----| 1 -> [RegExpConstant, RegExpNormalChar] abc
# 227| [RegExpConstant, RegExpNormalChar] i-s
# 227| [RegExpConstant, RegExpNormalChar] abc
# 230| [RegExpConstant, RegExpNormalChar] abc
# 230| [RegExpSequence] abc(?i)def
#-----| 0 -> [RegExpConstant, RegExpNormalChar] abc
#-----| 1 -> [RegExpGroup] (?i)
#-----| 2 -> [RegExpConstant, RegExpNormalChar] def
# 230| [RegExpGroup] (?i)
#-----| 0 -> [RegExpConstant, RegExpNormalChar] i
# 230| [RegExpConstant, RegExpNormalChar] i
# 230| [RegExpConstant, RegExpNormalChar] def
# 231| [RegExpConstant, RegExpNormalChar] abc
# 231| [RegExpSequence] abc(?i:def)ghi
#-----| 0 -> [RegExpConstant, RegExpNormalChar] abc
#-----| 1 -> [RegExpGroup] (?i:def)
#-----| 2 -> [RegExpConstant, RegExpNormalChar] ghi
# 231| [RegExpGroup] (?i:def)
#-----| 0 -> [RegExpConstant, RegExpNormalChar] i:def
# 231| [RegExpConstant, RegExpNormalChar] i:def
# 231| [RegExpConstant, RegExpNormalChar] ghi
# 232| [RegExpGroup] (?i)
#-----| 0 -> [RegExpConstant, RegExpNormalChar] i
# 232| [RegExpConstant, RegExpNormalChar] i
# 232| [RegExpConstant, RegExpNormalChar] abc
# 232| [RegExpConstant, RegExpNormalChar] -i
# 232| [RegExpConstant, RegExpNormalChar] def

View File

@@ -223,4 +223,11 @@ func myRegexpMethodsTests(b: Bool, str_unknown: String) throws {
_ = input.replacingOccurrences(of: ".*", with: "", options: [.regularExpression, .caseInsensitive]) // $ MISSING: regex=.* input=input modes=IGNORECASE
_ = NSString(string: "abc").replacingOccurrences(of: ".*", with: "", options: [.regularExpression, .caseInsensitive], range: NSMakeRange(0, inputNS.length)) // $ MISSING: regex=.* input=inputNS modes=IGNORECASE
_ = try Regex("(?i-s)abc").firstMatch(in: input) // $ input=input regex=(?i-s)abc MISSING: modes=IGNORECASE SPURIOUS: modes="DOTALL | IGNORECASE"
// these cases use parse modes on localized areas of the regex, which we don't currently support
_ = try Regex("abc(?i)def").firstMatch(in: input) // $ input=input modes=IGNORECASE regex=abc(?i)def
_ = try Regex("abc(?i:def)ghi").firstMatch(in: input) // $ input=input modes=IGNORECASE regex=abc(?i:def)ghi
_ = try Regex("(?i)abc(?-i)def").firstMatch(in: input) // $ input=input modes=IGNORECASE regex=(?i)abc(?-i)def SPURIOUS: hasParseFailure=
}