Skip to content

Commit 50196d0

Browse files
committed
Inline Expectation Tests: sync
1 parent c1e6996 commit 50196d0

File tree

6 files changed

+66
-18
lines changed

6 files changed

+66
-18
lines changed

cpp/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,20 @@ private string getColumnString(TColumn column) {
239239

240240
/**
241241
* RegEx pattern to match a single expected result, not including the leading `$`. It consists of one or
242-
* more comma-separated tags containing only letters, digits, `-` and `_` (note that the first character
243-
* must not be a digit), optionally followed by `=` and the expected value.
242+
* more comma-separated tags optionally followed by `=` and the expected value.
243+
*
244+
* Tags must be only letters, digits, `-` and `_` (note that the first character
245+
* must not be a digit), but can contain anything enclosed in a square brackets.
246+
*
247+
* Examples:
248+
* - `tag`
249+
* - `tag=value`
250+
* - `tag,tag2=value`
251+
* - `tag[foo bar]=value`
244252
*/
245253
private string expectationPattern() {
246254
exists(string tag, string tags, string value |
247-
tag = "[A-Za-z-_][A-Za-z-_0-9]*" and
255+
tag = "[A-Za-z-_](?:[A-Za-z-_0-9]|\\[[^\\]]*\\])*" and
248256
tags = "((?:" + tag + ")(?:\\s*,\\s*" + tag + ")*)" and
249257
// In Python, we allow both `"` and `'` for strings, as well as the prefixes `bru`.
250258
// For example, `b"foo"`.

csharp/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,20 @@ private string getColumnString(TColumn column) {
239239

240240
/**
241241
* RegEx pattern to match a single expected result, not including the leading `$`. It consists of one or
242-
* more comma-separated tags containing only letters, digits, `-` and `_` (note that the first character
243-
* must not be a digit), optionally followed by `=` and the expected value.
242+
* more comma-separated tags optionally followed by `=` and the expected value.
243+
*
244+
* Tags must be only letters, digits, `-` and `_` (note that the first character
245+
* must not be a digit), but can contain anything enclosed in a square brackets.
246+
*
247+
* Examples:
248+
* - `tag`
249+
* - `tag=value`
250+
* - `tag,tag2=value`
251+
* - `tag[foo bar]=value`
244252
*/
245253
private string expectationPattern() {
246254
exists(string tag, string tags, string value |
247-
tag = "[A-Za-z-_][A-Za-z-_0-9]*" and
255+
tag = "[A-Za-z-_](?:[A-Za-z-_0-9]|\\[[^\\]]*\\])*" and
248256
tags = "((?:" + tag + ")(?:\\s*,\\s*" + tag + ")*)" and
249257
// In Python, we allow both `"` and `'` for strings, as well as the prefixes `bru`.
250258
// For example, `b"foo"`.

go/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,20 @@ private string getColumnString(TColumn column) {
239239

240240
/**
241241
* RegEx pattern to match a single expected result, not including the leading `$`. It consists of one or
242-
* more comma-separated tags containing only letters, digits, `-` and `_` (note that the first character
243-
* must not be a digit), optionally followed by `=` and the expected value.
242+
* more comma-separated tags optionally followed by `=` and the expected value.
243+
*
244+
* Tags must be only letters, digits, `-` and `_` (note that the first character
245+
* must not be a digit), but can contain anything enclosed in a square brackets.
246+
*
247+
* Examples:
248+
* - `tag`
249+
* - `tag=value`
250+
* - `tag,tag2=value`
251+
* - `tag[foo bar]=value`
244252
*/
245253
private string expectationPattern() {
246254
exists(string tag, string tags, string value |
247-
tag = "[A-Za-z-_][A-Za-z-_0-9]*" and
255+
tag = "[A-Za-z-_](?:[A-Za-z-_0-9]|\\[[^\\]]*\\])*" and
248256
tags = "((?:" + tag + ")(?:\\s*,\\s*" + tag + ")*)" and
249257
// In Python, we allow both `"` and `'` for strings, as well as the prefixes `bru`.
250258
// For example, `b"foo"`.

java/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,20 @@ private string getColumnString(TColumn column) {
239239

240240
/**
241241
* RegEx pattern to match a single expected result, not including the leading `$`. It consists of one or
242-
* more comma-separated tags containing only letters, digits, `-` and `_` (note that the first character
243-
* must not be a digit), optionally followed by `=` and the expected value.
242+
* more comma-separated tags optionally followed by `=` and the expected value.
243+
*
244+
* Tags must be only letters, digits, `-` and `_` (note that the first character
245+
* must not be a digit), but can contain anything enclosed in a square brackets.
246+
*
247+
* Examples:
248+
* - `tag`
249+
* - `tag=value`
250+
* - `tag,tag2=value`
251+
* - `tag[foo bar]=value`
244252
*/
245253
private string expectationPattern() {
246254
exists(string tag, string tags, string value |
247-
tag = "[A-Za-z-_][A-Za-z-_0-9]*" and
255+
tag = "[A-Za-z-_](?:[A-Za-z-_0-9]|\\[[^\\]]*\\])*" and
248256
tags = "((?:" + tag + ")(?:\\s*,\\s*" + tag + ")*)" and
249257
// In Python, we allow both `"` and `'` for strings, as well as the prefixes `bru`.
250258
// For example, `b"foo"`.

ql/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,20 @@ private string getColumnString(TColumn column) {
239239

240240
/**
241241
* RegEx pattern to match a single expected result, not including the leading `$`. It consists of one or
242-
* more comma-separated tags containing only letters, digits, `-` and `_` (note that the first character
243-
* must not be a digit), optionally followed by `=` and the expected value.
242+
* more comma-separated tags optionally followed by `=` and the expected value.
243+
*
244+
* Tags must be only letters, digits, `-` and `_` (note that the first character
245+
* must not be a digit), but can contain anything enclosed in a square brackets.
246+
*
247+
* Examples:
248+
* - `tag`
249+
* - `tag=value`
250+
* - `tag,tag2=value`
251+
* - `tag[foo bar]=value`
244252
*/
245253
private string expectationPattern() {
246254
exists(string tag, string tags, string value |
247-
tag = "[A-Za-z-_][A-Za-z-_0-9]*" and
255+
tag = "[A-Za-z-_](?:[A-Za-z-_0-9]|\\[[^\\]]*\\])*" and
248256
tags = "((?:" + tag + ")(?:\\s*,\\s*" + tag + ")*)" and
249257
// In Python, we allow both `"` and `'` for strings, as well as the prefixes `bru`.
250258
// For example, `b"foo"`.

ruby/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,20 @@ private string getColumnString(TColumn column) {
239239

240240
/**
241241
* RegEx pattern to match a single expected result, not including the leading `$`. It consists of one or
242-
* more comma-separated tags containing only letters, digits, `-` and `_` (note that the first character
243-
* must not be a digit), optionally followed by `=` and the expected value.
242+
* more comma-separated tags optionally followed by `=` and the expected value.
243+
*
244+
* Tags must be only letters, digits, `-` and `_` (note that the first character
245+
* must not be a digit), but can contain anything enclosed in a square brackets.
246+
*
247+
* Examples:
248+
* - `tag`
249+
* - `tag=value`
250+
* - `tag,tag2=value`
251+
* - `tag[foo bar]=value`
244252
*/
245253
private string expectationPattern() {
246254
exists(string tag, string tags, string value |
247-
tag = "[A-Za-z-_][A-Za-z-_0-9]*" and
255+
tag = "[A-Za-z-_](?:[A-Za-z-_0-9]|\\[[^\\]]*\\])*" and
248256
tags = "((?:" + tag + ")(?:\\s*,\\s*" + tag + ")*)" and
249257
// In Python, we allow both `"` and `'` for strings, as well as the prefixes `bru`.
250258
// For example, `b"foo"`.

0 commit comments

Comments
 (0)