Skip to content

Commit abf9fdb

Browse files
Timur KelmanTimur Kelman
authored andcommitted
restore tests lost in merge conflicts
1 parent 257aae9 commit abf9fdb

1 file changed

Lines changed: 82 additions & 0 deletions

File tree

Tests/CSharp/MemberTests/MemberTests.cs

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4092,4 +4092,86 @@ public void M([Optional, DefaultParameterValue(""a"")] string a, [Optional, Defa
40924092
}
40934093
}");
40944094
}
4095+
4096+
[Fact]
4097+
public async Task TestRefConstArgumentAsync()
4098+
{
4099+
await TestConversionVisualBasicToCSharpAsync(
4100+
@"Class RefConstArgument
4101+
Const a As String = ""a""
4102+
Sub S()
4103+
Const b As String = ""b""
4104+
MO(a)
4105+
MS(b)
4106+
End Sub
4107+
Sub MO(ByRef s As Object) : End Sub
4108+
Sub MS(ByRef s As String) : End Sub
4109+
End Class", @"
4110+
internal partial class RefConstArgument
4111+
{
4112+
private const string a = ""a"";
4113+
public void S()
4114+
{
4115+
const string b = ""b"";
4116+
object args = a;
4117+
MO(ref args);
4118+
string args1 = b;
4119+
MS(ref args1);
4120+
}
4121+
public void MO(ref object s)
4122+
{
4123+
}
4124+
public void MS(ref string s)
4125+
{
4126+
}
4127+
}");
4128+
}
4129+
4130+
[Fact]
4131+
public async Task TestMissingByRefArgumentWithNoExplicitDefaultValueAsync()
4132+
{
4133+
await TestConversionVisualBasicToCSharpAsync(
4134+
@"Imports System.Runtime.InteropServices
4135+
4136+
Class MissingByRefArgumentWithNoExplicitDefaultValue
4137+
Sub S()
4138+
ByRefNoDefault()
4139+
OptionalByRefNoDefault()
4140+
OptionalByRefWithDefault()
4141+
End Sub
4142+
4143+
Private Sub ByRefNoDefault(ByRef str1 As String) : End Sub
4144+
Private Sub OptionalByRefNoDefault(<[Optional]> ByRef str2 As String) : End Sub
4145+
Private Sub OptionalByRefWithDefault(<[Optional], DefaultParameterValue(""a"")> ByRef str3 As String) : End Sub
4146+
End Class", @"using System.Runtime.InteropServices;
4147+
4148+
internal partial class MissingByRefArgumentWithNoExplicitDefaultValue
4149+
{
4150+
public void S()
4151+
{
4152+
ByRefNoDefault();
4153+
string argstr2 = default;
4154+
OptionalByRefNoDefault(str2: ref argstr2);
4155+
string argstr3 = ""a"";
4156+
OptionalByRefWithDefault(str3: ref argstr3);
4157+
}
4158+
4159+
private void ByRefNoDefault(ref string str1)
4160+
{
4161+
}
4162+
private void OptionalByRefNoDefault([Optional] ref string str2)
4163+
{
4164+
}
4165+
private void OptionalByRefWithDefault([Optional][DefaultParameterValue(""a"")] ref string str3)
4166+
{
4167+
}
4168+
}
4169+
3 source compilation errors:
4170+
BC30455: Argument not specified for parameter 'str1' of 'Private Sub ByRefNoDefault(ByRef str1 As String)'.
4171+
BC30455: Argument not specified for parameter 'str2' of 'Private Sub OptionalByRefNoDefault(ByRef str2 As String)'.
4172+
BC30455: Argument not specified for parameter 'str3' of 'Private Sub OptionalByRefWithDefault(ByRef str3 As String)'.
4173+
1 target compilation errors:
4174+
CS7036: There is no argument given that corresponds to the required formal parameter 'str1' of 'MissingByRefArgumentWithNoExplicitDefaultValue.ByRefNoDefault(ref string)'
4175+
");
4176+
}
40954177
}

0 commit comments

Comments
 (0)