Skip to content

Commit c611314

Browse files
committed
C#: Add test for interpolated strings, where newlines are used in the provided expression.
1 parent 3a4623b commit c611314

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
3+
public class MyTestClass
4+
{
5+
public string M1(int x)
6+
{
7+
return $"This is my int {x switch
8+
{
9+
42 => "forty two",
10+
_ => "something else"
11+
}}.";
12+
}
13+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| Strings.cs:7:16:11:12 | $"..." | Strings.cs:7:18:7:32 | "This is my int " |
2+
| Strings.cs:7:16:11:12 | $"..." | Strings.cs:7:34:11:9 | ... switch { ... } |
3+
| Strings.cs:7:16:11:12 | $"..." | Strings.cs:11:11:11:11 | "." |
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import csharp
2+
3+
query predicate interpolatedstrings(InterpolatedStringExpr se, Expr e) {
4+
se.getFile().getStem() = "Strings" and
5+
(e = se.getAText() or e = se.getAnInsert())
6+
}

0 commit comments

Comments
 (0)