File tree Expand file tree Collapse file tree
swift/ql/test/library-tests/regex Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6254,3 +6254,22 @@ regex.swift:
62546254# 157| [RegExpConstant, RegExpEscape] \n
62556255
62566256# 158| [RegExpConstant, RegExpEscape] \n
6257+
6258+ # 168| [RegExpConstant, RegExpNormalChar] aa
6259+
6260+ # 168| [RegExpAlt] aa|bb
6261+ #-----| 0 -> [RegExpConstant, RegExpNormalChar] aa
6262+ #-----| 1 -> [RegExpConstant, RegExpNormalChar] bb
6263+
6264+ # 168| [RegExpConstant, RegExpNormalChar] bb
6265+
6266+ # 172| [RegExpConstant, RegExpNormalChar]
6267+ # 172| bb
6268+
6269+ # 172| [RegExpConstant, RegExpNormalChar] aa
6270+
6271+ # 172| [RegExpAlt] aa|
6272+ # 172| bb
6273+ #-----| 0 -> [RegExpConstant, RegExpNormalChar] aa
6274+ #-----| 1 -> [RegExpConstant, RegExpNormalChar]
6275+ #-----| bb
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ class NSRegularExpression : NSObject {
9898//
9999// the focus for these tests is different ways of evaluating regexps.
100100
101- func myRegexpMethodsTests( b: Bool ) throws {
101+ func myRegexpMethodsTests( b: Bool , str_unknown : String ) throws {
102102 let input = " abcdef "
103103 let regex = try Regex ( " .* " )
104104
@@ -156,4 +156,21 @@ func myRegexpMethodsTests(b: Bool) throws {
156156 _ = try Regex ( " \n " ) . firstMatch ( in: input) // $ regex=NEWLINE input=input
157157 _ = try Regex ( " \\ n " ) . firstMatch ( in: input) // $ regex=\n input=input
158158 _ = try Regex ( #"\n"# ) . firstMatch ( in: input) // $ regex=\n input=input
159+
160+ // --- interpolated values ---
161+
162+ let str_constant = " aa "
163+ _ = try Regex ( " \( str_constant) )|bb " ) . firstMatch ( in: input) // $ input=input MISSING: regex=aa|bb
164+ _ = try Regex ( " \( str_unknown) )|bb " ) . firstMatch ( in: input) // $ input=input
165+
166+ // --- multi-line ---
167+
168+ _ = try Regex ( """
169+ aa|bb
170+ """ ) . firstMatch ( in: input) // $ input=input regex=aa|bb
171+
172+ _ = try Regex ( """
173+ aa|
174+ bb
175+ """ ) . firstMatch ( in: input) // $ input=input regex=aa|NEWLINEbb
159176}
You can’t perform that action at this time.
0 commit comments