From 79d6f8a68d7c6ab0ad75576f1cdd99bc1c859afe Mon Sep 17 00:00:00 2001 From: Timur Kelman Date: Fri, 19 Jul 2024 13:44:37 +0200 Subject: [PATCH] add tests for With ref-return properties --- .../WithRefReturnStructure.vb | 13 +++++++++---- .../WithRefReturnStructure.cs | 19 +++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Tests/TestData/MultiFileCharacterization/SourceFiles/VisualBasicUsesCSharpRefReturn/WithRefReturnStructure.vb b/Tests/TestData/MultiFileCharacterization/SourceFiles/VisualBasicUsesCSharpRefReturn/WithRefReturnStructure.vb index 6653f751..1e22cf70 100644 --- a/Tests/TestData/MultiFileCharacterization/SourceFiles/VisualBasicUsesCSharpRefReturn/WithRefReturnStructure.vb +++ b/Tests/TestData/MultiFileCharacterization/SourceFiles/VisualBasicUsesCSharpRefReturn/WithRefReturnStructure.vb @@ -13,10 +13,15 @@ Dim lst As CSharpRefReturn.RefReturnList(Of SomeStruct) Dim s As String - 'With lst(0) - ' .P = s - ' s = .P - 'End With + With lst(0) + .P = s + s = .P + End With + + With lst.RefProperty + .P = s + s = .P + End With End Sub Structure SomeStruct diff --git a/Tests/TestData/MultiFileCharacterization/VBToCSResults/ConvertVbUsingCSharpRefReturnOnly/VisualBasicUsesCSharpRefReturn/WithRefReturnStructure.cs b/Tests/TestData/MultiFileCharacterization/VBToCSResults/ConvertVbUsingCSharpRefReturnOnly/VisualBasicUsesCSharpRefReturn/WithRefReturnStructure.cs index 45caf235..64b3cd19 100644 --- a/Tests/TestData/MultiFileCharacterization/VBToCSResults/ConvertVbUsingCSharpRefReturnOnly/VisualBasicUsesCSharpRefReturn/WithRefReturnStructure.cs +++ b/Tests/TestData/MultiFileCharacterization/VBToCSResults/ConvertVbUsingCSharpRefReturnOnly/VisualBasicUsesCSharpRefReturn/WithRefReturnStructure.cs @@ -17,13 +17,20 @@ public void UseArr() public void UseRefReturn() { - CSharpRefReturn.RefReturnList lst; - string s; + var lst = default(CSharpRefReturn.RefReturnList); + var s = default(string); + + { + ref var withBlock = ref lst[0]; + withBlock.P = s; + s = withBlock.P; + } - // With lst(0) - // .P = s - // s = .P - // End With + { + ref var withBlock1 = ref lst.RefProperty; + withBlock1.P = s; + s = withBlock1.P; + } } public struct SomeStruct