Skip to content

Commit 2c37cb7

Browse files
committed
C#: Add more default parameter test-cases.
1 parent 6cb2ce5 commit 2c37cb7

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

csharp/ql/test/library-tests/parameters/Parameters.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public class Parameters
2222
public void M14([Optional, DateTimeConstant(14L)] DateTime arg4) => throw null;
2323
public void M15([Optional, DateTimeConstant(10001L)] DateTime? arg5) => throw null;
2424
public void M16([Optional, DefaultParameterValue(6L)] long arg6) => throw null;
25+
public void M17([Optional, DefaultParameterValue(null)] object arg7) => throw null;
26+
public void M18([Optional, DefaultParameterValue(3)] int? arg8) => throw null;
27+
public void M19([Optional, DecimalConstant(1, 0, 0, 0, 103)] decimal arg9) => throw null;
2528

2629
public struct MyStruct { }
2730
public enum MyEnum { A = 1, B = 2 }

csharp/ql/test/library-tests/parameters/Parameters.cs_

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public class ParametersDll
2222
public void M14([Optional, DateTimeConstant(14L)] DateTime arg4) => throw null;
2323
public void M15([Optional, DateTimeConstant(10001L)] DateTime? arg5) => throw null;
2424
public void M16([Optional, DefaultParameterValue(6L)] long arg6) => throw null;
25+
public void M17([Optional, DefaultParameterValue(null)] object arg7) => throw null;
26+
public void M18([Optional, DefaultParameterValue(3)] int? arg8) => throw null;
27+
public void M19([Optional, DecimalConstant(1, 0, 0, 0, 103)] decimal arg9) => throw null;
2528

2629
public struct MyStruct { }
2730
public enum MyEnum { A = 1, B = 2 }
Binary file not shown.

csharp/ql/test/library-tests/parameters/Parameters.expected

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ withDefaultValue
3636
| Parameters.cs:22:17:22:19 | M14 | Parameters.cs:22:64:22:67 | arg4 | 0 | Parameters.cs:22:21:22:67 | object creation of type DateTime | - |
3737
| Parameters.cs:23:17:23:19 | M15 | Parameters.cs:23:68:23:71 | arg5 | 0 | Parameters.cs:23:21:23:71 | object creation of type DateTime | - |
3838
| Parameters.cs:24:17:24:19 | M16 | Parameters.cs:24:64:24:67 | arg6 | 0 | Parameters.cs:24:21:24:67 | 6 | 6 |
39+
| Parameters.cs:25:17:25:19 | M17 | Parameters.cs:25:68:25:71 | arg7 | 0 | Parameters.cs:25:21:25:71 | default | null |
40+
| Parameters.cs:26:17:26:19 | M18 | Parameters.cs:26:63:26:66 | arg8 | 0 | Parameters.cs:26:21:26:66 | 3 | 3 |
41+
| Parameters.cs:27:17:27:19 | M19 | Parameters.cs:27:74:27:77 | arg9 | 0 | Parameters.cs:27:21:27:77 | 10.3 | 10.3 |
3942
| Parameters.dll:0:0:0:0 | M2 | Parameters.dll:0:0:0:0 | b | 1 | Parameters.dll:0:0:0:0 | default | null |
4043
| Parameters.dll:0:0:0:0 | M2 | Parameters.dll:0:0:0:0 | c | 2 | Parameters.dll:0:0:0:0 | "default string" | default string |
4144
| Parameters.dll:0:0:0:0 | M3 | Parameters.dll:0:0:0:0 | a | 0 | Parameters.dll:0:0:0:0 | 1 | 1 |
@@ -60,6 +63,9 @@ withDefaultValue
6063
| Parameters.dll:0:0:0:0 | M14 | Parameters.dll:0:0:0:0 | arg4 | 0 | Parameters.dll:0:0:0:0 | object creation of type DateTime | - |
6164
| Parameters.dll:0:0:0:0 | M15 | Parameters.dll:0:0:0:0 | arg5 | 0 | Parameters.dll:0:0:0:0 | object creation of type DateTime | - |
6265
| Parameters.dll:0:0:0:0 | M16 | Parameters.dll:0:0:0:0 | arg6 | 0 | Parameters.dll:0:0:0:0 | 6 | 6 |
66+
| Parameters.dll:0:0:0:0 | M17 | Parameters.dll:0:0:0:0 | arg7 | 0 | Parameters.dll:0:0:0:0 | default | null |
67+
| Parameters.dll:0:0:0:0 | M18 | Parameters.dll:0:0:0:0 | arg8 | 0 | Parameters.dll:0:0:0:0 | 3 | 3 |
68+
| Parameters.dll:0:0:0:0 | M19 | Parameters.dll:0:0:0:0 | arg9 | 0 | Parameters.dll:0:0:0:0 | 10.3 | 10.3 |
6369
dateTimeDefaults
6470
| Parameters.cs:22:17:22:19 | M14 | Parameters.cs:22:64:22:67 | arg4 | Parameters.cs:22:21:22:67 | object creation of type DateTime | DateTime(long) | 14 |
6571
| Parameters.cs:23:17:23:19 | M15 | Parameters.cs:23:68:23:71 | arg5 | Parameters.cs:23:21:23:71 | object creation of type DateTime | DateTime(long) | 10001 |

0 commit comments

Comments
 (0)