Skip to content

Commit 798974f

Browse files
Timur KelmanTimur Kelman
authored andcommitted
add a test for omitter arguments
1 parent fc0a1e6 commit 798974f

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Tests/CSharp/MemberTests/MemberTests.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4047,6 +4047,49 @@ public static int StaticTestProperty
40474047
return _StaticTestProperty_sPrevPosition + 1;
40484048
}
40494049
}
4050+
}");
4051+
}
4052+
4053+
[Fact]
4054+
public async Task TestOmittedArgumentsAsync()
4055+
{
4056+
await TestConversionVisualBasicToCSharpAsync(
4057+
@"Class OmittedArguments
4058+
Sub M(Optional a As String = ""a"", ByRef Optional b As String = ""b"")
4059+
Dim s As String = """"
4060+
4061+
M() 'omitted implicitely
4062+
M(,) 'omitted explicitely
4063+
4064+
M(s) 'omitted implicitely
4065+
M(s,) 'omitted explicitely
4066+
4067+
M(a:=s) 'omitted implicitely
4068+
M(a:=s, ) 'omitted explicitely
4069+
End Sub
4070+
End Class", @"using System.Runtime.InteropServices;
4071+
4072+
internal partial class OmittedArguments
4073+
{
4074+
public void M([Optional, DefaultParameterValue(""a"")] string a, [Optional, DefaultParameterValue(""b"")] ref string b)
4075+
{
4076+
string s = """";
4077+
4078+
string argb = ""b"";
4079+
M(b: ref argb); // omitted implicitely
4080+
string argb1 = ""b"";
4081+
M(b: ref argb1); // omitted explicitely
4082+
4083+
string argb2 = ""b"";
4084+
M(s, b: ref argb2); // omitted implicitely
4085+
string argb3 = ""b"";
4086+
M(s, b: ref argb3); // omitted explicitely
4087+
4088+
string argb4 = ""b"";
4089+
M(a: s, b: ref argb4); // omitted implicitely
4090+
string argb5 = ""b"";
4091+
M(a: s, b: ref argb5); // omitted explicitely
4092+
}
40504093
}");
40514094
}
40524095
}

0 commit comments

Comments
 (0)