Skip to content

Commit 79d6f8a

Browse files
Timur KelmanTimur Kelman
authored andcommitted
add tests for With ref-return properties
1 parent f3497e3 commit 79d6f8a

2 files changed

Lines changed: 22 additions & 10 deletions

File tree

Tests/TestData/MultiFileCharacterization/SourceFiles/VisualBasicUsesCSharpRefReturn/WithRefReturnStructure.vb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@
1313
Dim lst As CSharpRefReturn.RefReturnList(Of SomeStruct)
1414
Dim s As String
1515

16-
'With lst(0)
17-
' .P = s
18-
' s = .P
19-
'End With
16+
With lst(0)
17+
.P = s
18+
s = .P
19+
End With
20+
21+
With lst.RefProperty
22+
.P = s
23+
s = .P
24+
End With
2025
End Sub
2126

2227
Structure SomeStruct

Tests/TestData/MultiFileCharacterization/VBToCSResults/ConvertVbUsingCSharpRefReturnOnly/VisualBasicUsesCSharpRefReturn/WithRefReturnStructure.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,20 @@ public void UseArr()
1717

1818
public void UseRefReturn()
1919
{
20-
CSharpRefReturn.RefReturnList<SomeStruct> lst;
21-
string s;
20+
var lst = default(CSharpRefReturn.RefReturnList<SomeStruct>);
21+
var s = default(string);
22+
23+
{
24+
ref var withBlock = ref lst[0];
25+
withBlock.P = s;
26+
s = withBlock.P;
27+
}
2228

23-
// With lst(0)
24-
// .P = s
25-
// s = .P
26-
// End With
29+
{
30+
ref var withBlock1 = ref lst.RefProperty;
31+
withBlock1.P = s;
32+
s = withBlock1.P;
33+
}
2734
}
2835

2936
public struct SomeStruct

0 commit comments

Comments
 (0)