diff --git a/csharp/ql/test/library-tests/csharp10/ConstInterpolatedString.cs b/csharp/ql/test/library-tests/csharp10/ConstInterpolatedString.cs new file mode 100644 index 00000000000..1dba25d5182 --- /dev/null +++ b/csharp/ql/test/library-tests/csharp10/ConstInterpolatedString.cs @@ -0,0 +1,8 @@ +using System; + +public class MyConstStringInterpolationClass +{ + public const string hello = "Hello"; + public const string helloWorld = $"{hello} World"; + public const string reallyHelloWorld = $"Really {helloWorld}"; +} \ No newline at end of file diff --git a/csharp/ql/test/library-tests/csharp10/constInterpolatedString.expected b/csharp/ql/test/library-tests/csharp10/constInterpolatedString.expected new file mode 100644 index 00000000000..849ded1bb57 --- /dev/null +++ b/csharp/ql/test/library-tests/csharp10/constInterpolatedString.expected @@ -0,0 +1,6 @@ +inserts +| ConstInterpolatedString.cs:6:38:6:53 | $"..." | ConstInterpolatedString.cs:6:41:6:45 | access to constant hello | +| ConstInterpolatedString.cs:7:44:7:65 | $"..." | ConstInterpolatedString.cs:7:54:7:63 | access to constant helloWorld | +texts +| ConstInterpolatedString.cs:6:38:6:53 | $"..." | ConstInterpolatedString.cs:6:47:6:52 | " World" | +| ConstInterpolatedString.cs:7:44:7:65 | $"..." | ConstInterpolatedString.cs:7:46:7:52 | "Really " | diff --git a/csharp/ql/test/library-tests/csharp10/constInterpolatedString.ql b/csharp/ql/test/library-tests/csharp10/constInterpolatedString.ql new file mode 100644 index 00000000000..8f3ef221828 --- /dev/null +++ b/csharp/ql/test/library-tests/csharp10/constInterpolatedString.ql @@ -0,0 +1,7 @@ +import csharp + +query predicate inserts(InterpolatedStringExpr expr, Expr e) { expr.getAnInsert() = e } + +query predicate texts(InterpolatedStringExpr expr, StringLiteral literal) { + expr.getAText() = literal +}