Skip to content

Commit 0f7e369

Browse files
committed
C#: Add test case.
1 parent 02c3732 commit 0f7e369

2 files changed

Lines changed: 21 additions & 13 deletions

File tree

csharp/ql/test/library-tests/spans/Slice.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ public void M(int a, int b)
1010
var sub3 = s[3..];
1111
var sub4 = s[..^4];
1212
var sub5 = s[a..^b];
13+
var sub6 = s[..];
1314

1415
Span<int> sp = null;
1516
var slice1 = sp[5..a];
1617
var slice2 = sp[..6];
1718
var slice3 = sp[7..];
1819
var slice4 = sp[..^8];
1920
var slice5 = sp[a..^b];
21+
var slice6 = sp[..];
2022
}
2123
}

csharp/ql/test/library-tests/spans/slice.expected

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,26 @@ methodCalls
99
| Slice.cs:11:20:11:26 | call to method Substring | Substring(int, int) | 1 | access to property Length - 4 |
1010
| Slice.cs:12:20:12:27 | call to method Substring | Substring(int, int) | 0 | access to parameter a |
1111
| Slice.cs:12:20:12:27 | call to method Substring | Substring(int, int) | 1 | access to property Length - access to parameter b - access to parameter a |
12-
| Slice.cs:15:22:15:29 | call to method Slice | Slice(int, int) | 0 | 5 |
13-
| Slice.cs:15:22:15:29 | call to method Slice | Slice(int, int) | 1 | access to parameter a - 5 |
14-
| Slice.cs:16:22:16:28 | call to method Slice | Slice(int, int) | 0 | 0 |
15-
| Slice.cs:16:22:16:28 | call to method Slice | Slice(int, int) | 1 | 6 |
16-
| Slice.cs:17:22:17:28 | call to method Slice | Slice(int, int) | 0 | 7 |
17-
| Slice.cs:17:22:17:28 | call to method Slice | Slice(int, int) | 1 | access to property Length - 7 |
18-
| Slice.cs:18:22:18:29 | call to method Slice | Slice(int, int) | 0 | 0 |
19-
| Slice.cs:18:22:18:29 | call to method Slice | Slice(int, int) | 1 | access to property Length - 8 |
20-
| Slice.cs:19:22:19:30 | call to method Slice | Slice(int, int) | 0 | access to parameter a |
21-
| Slice.cs:19:22:19:30 | call to method Slice | Slice(int, int) | 1 | access to property Length - access to parameter b - access to parameter a |
12+
| Slice.cs:13:20:13:24 | call to method Substring | Substring(int, int) | 0 | 0 |
13+
| Slice.cs:13:20:13:24 | call to method Substring | Substring(int, int) | 1 | access to property Length |
14+
| Slice.cs:16:22:16:29 | call to method Slice | Slice(int, int) | 0 | 5 |
15+
| Slice.cs:16:22:16:29 | call to method Slice | Slice(int, int) | 1 | access to parameter a - 5 |
16+
| Slice.cs:17:22:17:28 | call to method Slice | Slice(int, int) | 0 | 0 |
17+
| Slice.cs:17:22:17:28 | call to method Slice | Slice(int, int) | 1 | 6 |
18+
| Slice.cs:18:22:18:28 | call to method Slice | Slice(int, int) | 0 | 7 |
19+
| Slice.cs:18:22:18:28 | call to method Slice | Slice(int, int) | 1 | access to property Length - 7 |
20+
| Slice.cs:19:22:19:29 | call to method Slice | Slice(int, int) | 0 | 0 |
21+
| Slice.cs:19:22:19:29 | call to method Slice | Slice(int, int) | 1 | access to property Length - 8 |
22+
| Slice.cs:20:22:20:30 | call to method Slice | Slice(int, int) | 0 | access to parameter a |
23+
| Slice.cs:20:22:20:30 | call to method Slice | Slice(int, int) | 1 | access to property Length - access to parameter b - access to parameter a |
24+
| Slice.cs:21:22:21:27 | call to method Slice | Slice(int, int) | 0 | 0 |
25+
| Slice.cs:21:22:21:27 | call to method Slice | Slice(int, int) | 1 | access to property Length |
2226
propertyCalls
2327
| Slice.cs:10:20:10:25 | access to property Length | Slice.cs:10:20:10:20 | access to local variable s |
2428
| Slice.cs:11:20:11:26 | access to property Length | Slice.cs:11:20:11:20 | access to local variable s |
2529
| Slice.cs:12:20:12:27 | access to property Length | Slice.cs:12:20:12:20 | access to local variable s |
26-
| Slice.cs:17:22:17:28 | access to property Length | Slice.cs:17:22:17:23 | access to local variable sp |
27-
| Slice.cs:18:22:18:29 | access to property Length | Slice.cs:18:22:18:23 | access to local variable sp |
28-
| Slice.cs:19:22:19:30 | access to property Length | Slice.cs:19:22:19:23 | access to local variable sp |
30+
| Slice.cs:13:20:13:24 | access to property Length | Slice.cs:13:20:13:20 | access to local variable s |
31+
| Slice.cs:18:22:18:28 | access to property Length | Slice.cs:18:22:18:23 | access to local variable sp |
32+
| Slice.cs:19:22:19:29 | access to property Length | Slice.cs:19:22:19:23 | access to local variable sp |
33+
| Slice.cs:20:22:20:30 | access to property Length | Slice.cs:20:22:20:23 | access to local variable sp |
34+
| Slice.cs:21:22:21:27 | access to property Length | Slice.cs:21:22:21:23 | access to local variable sp |

0 commit comments

Comments
 (0)