Skip to content

Commit 0b598a5

Browse files
committed
C#: Update string literal test query and expected output.
1 parent 4b56a06 commit 0b598a5

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

csharp/ql/test/library-tests/csharp11/strings.expected

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ interpolatedstrings
1111
| Strings.cs:33:24:36:11 | $"..." | Strings.cs:35:47:35:54 | access to local variable message2 |
1212
| Strings.cs:33:24:36:11 | $"..." | Strings.cs:35:57:35:57 | "}" |
1313
stringliterals
14-
| Strings.cs:18:24:23:11 | "This is my very long\n text message that spans\n accross multiple lines\nand is very useful." |
15-
| Strings.cs:27:1:28:14 | "The nested message\n is \\"" |
16-
| Strings.cs:28:25:29:29 | "\\" and everything\nspans multiple lines." |
17-
| Strings.cs:34:1:34:30 | "Show no curly braces: " |
18-
| Strings.cs:34:43:35:44 | "\nShow matching set of curly braces: {" |
19-
| Strings.cs:35:57:35:57 | "}" |
14+
| Strings.cs:18:24:23:11 | "This is my very long\n text message that spans\n accross multiple lines\nand is very useful." | StringLiteralUtf16 | String |
15+
| Strings.cs:27:1:28:14 | "The nested message\n is \\"" | StringLiteralUtf16 | String |
16+
| Strings.cs:28:25:29:29 | "\\" and everything\nspans multiple lines." | StringLiteralUtf16 | String |
17+
| Strings.cs:34:1:34:30 | "Show no curly braces: " | StringLiteralUtf16 | String |
18+
| Strings.cs:34:43:35:44 | "\nShow matching set of curly braces: {" | StringLiteralUtf16 | String |
19+
| Strings.cs:35:57:35:57 | "}" | StringLiteralUtf16 | String |
20+
| Strings.cs:43:17:43:27 | "AUTH8: " | StringLiteralUtf8 | ReadOnlySpan<Byte> |
21+
| Strings.cs:46:17:46:26 | "AUTH16: " | StringLiteralUtf16 | String |

csharp/ql/test/library-tests/csharp11/strings.ql

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ query predicate interpolatedstrings(InterpolatedStringExpr se, Expr e) {
55
(e = se.getAText() or e = se.getAnInsert())
66
}
77

8-
query predicate stringliterals(StringLiteral s) {
9-
s.getFile().getStem() = "Strings" and s.getEnclosingCallable().getName() = "M2"
8+
query predicate stringliterals(StringLiteral s, string qlclass, string type) {
9+
s.getFile().getStem() = "Strings" and
10+
s.getEnclosingCallable().getName() = ["M2", "M3"] and
11+
qlclass = s.getAPrimaryQlClass() and
12+
type = s.getType().toString()
1013
}

0 commit comments

Comments
 (0)