Skip to content

Commit ad4b937

Browse files
authored
Merge pull request github#5302 from RasmusWL/expectation-tests-allow-str-prefix
Approved by MathiasVP, tausbn
2 parents 15049ca + 0874712 commit ad4b937

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

cpp/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ private string expectationPattern() {
233233
exists(string tag, string tags, string value |
234234
tag = "[A-Za-z-_][A-Za-z-_0-9]*" and
235235
tags = "((?:" + tag + ")(?:\\s*,\\s*" + tag + ")*)" and
236-
value = "((?:\"[^\"]*\"|'[^']*'|\\S+)*)" and
236+
// In Python, we allow both `"` and `'` for strings, as well as the prefixes `bru`.
237+
// For example, `b"foo"`.
238+
value = "((?:[bru]*\"[^\"]*\"|[bru]*'[^']*'|\\S+)*)" and
237239
result = tags + "(?:=" + value + ")?"
238240
)
239241
}

java/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ private string expectationPattern() {
233233
exists(string tag, string tags, string value |
234234
tag = "[A-Za-z-_][A-Za-z-_0-9]*" and
235235
tags = "((?:" + tag + ")(?:\\s*,\\s*" + tag + ")*)" and
236-
value = "((?:\"[^\"]*\"|'[^']*'|\\S+)*)" and
236+
// In Python, we allow both `"` and `'` for strings, as well as the prefixes `bru`.
237+
// For example, `b"foo"`.
238+
value = "((?:[bru]*\"[^\"]*\"|[bru]*'[^']*'|\\S+)*)" and
237239
result = tags + "(?:=" + value + ")?"
238240
)
239241
}

python/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ private string expectationPattern() {
233233
exists(string tag, string tags, string value |
234234
tag = "[A-Za-z-_][A-Za-z-_0-9]*" and
235235
tags = "((?:" + tag + ")(?:\\s*,\\s*" + tag + ")*)" and
236-
value = "((?:\"[^\"]*\"|'[^']*'|\\S+)*)" and
236+
// In Python, we allow both `"` and `'` for strings, as well as the prefixes `bru`.
237+
// For example, `b"foo"`.
238+
value = "((?:[bru]*\"[^\"]*\"|[bru]*'[^']*'|\\S+)*)" and
237239
result = tags + "(?:=" + value + ")?"
238240
)
239241
}

0 commit comments

Comments
 (0)