From cf82b8fbe468264332993150ed8ac4ce1150ea8f Mon Sep 17 00:00:00 2001 From: Gen Lu Date: Fri, 7 Apr 2017 18:09:24 -0700 Subject: [PATCH] More VB tests for IArgument --- .../IOperation/IOperationTests_IArgument.cs | 2 +- .../IOperation/IOperationTests_IArgument.vb | 337 ++++++++++++++---- 2 files changed, 274 insertions(+), 65 deletions(-) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs index f2e49a755a3..b7f4e67d142 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests public partial class IOperationTests : SemanticModelTestBase { [Fact] - public void PositinalArgument() + public void PositionalArgument() { string source = @" class P diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IArgument.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IArgument.vb index 3cd24be7245..b159e7f119a 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IArgument.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IArgument.vb @@ -9,23 +9,129 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics Inherits SemanticModelTestBase - Public Sub ExplicitSimpleArgument() + Public Sub PositionalArgument() Dim source = .Value Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of InvocationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + Public Sub PositionalArgumentWithDefaultValue() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of InvocationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + Public Sub NamedArgumentListedInParameterOrder() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of InvocationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + Public Sub NamedArgumentListedOutOfParameterOrder() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of InvocationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + Public Sub NamedArgumentInParameterOrderWithDefaultValue() + Dim source = .Value + + Dim expectedOperationTree = .Value @@ -35,26 +141,26 @@ IInvocationExpression ( Sub P.M2(x As System.Int32, y As System.Double)) (Operat End Sub - Public Sub ExplicitSimpleArgumentByName() + Public Sub NamedArgumentInParameterOrderWithDefaultValueUsingOmittedSyntax() Dim source = .Value Dim expectedOperationTree = .Value Dim expectedDiagnostics = String.Empty @@ -63,24 +169,26 @@ IInvocationExpression ( Sub P.M2(x As System.Int32, y As System.Double)) (Operat End Sub - Public Sub XXXX() + Public Sub NamedArgumentOutOfParameterOrderWithDefaultValue() Dim source = .Value Dim expectedOperationTree = .Value Dim expectedDiagnostics = String.Empty @@ -89,24 +197,26 @@ IInvocationExpression ( Sub P.M2([x As System.Int32 = 0], [y As System.Int32 = 0 End Sub - Public Sub DefaultArgument() + Public Sub NamedAndPositionalArgumentsWithDefaultValue() Dim source = .Value Dim expectedOperationTree = .Value Dim expectedDiagnostics = String.Empty @@ -115,28 +225,22 @@ IInvocationExpression ( Sub P.M2(x As System.Int32, [y As System.Double = 0])) ( End Sub - Public Sub ParamArrayArgument() + Public Sub PositionalByRefNonModifiableArgument() Dim source = .Value Dim expectedOperationTree = .Value Dim expectedDiagnostics = String.Empty @@ -144,29 +248,103 @@ IInvocationExpression ( Sub P.M2(x As System.Int32, ParamArray array As System.I VerifyOperationTreeAndDiagnosticsForTest(Of InvocationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + - Public Sub ArrayAsParamsArrayArgument() + Public Sub PositionalByRefModifiableArgument() Dim source = .Value Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of InvocationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + Public Sub NamedByRefModifiableArgumentsOutOfParameterOrder() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of InvocationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + Public Sub DefaultValueForByRefParameter() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of InvocationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + Public Sub PositionalByRefNonModifiableArgumentWithConversion() + Dim source = .Value + + Dim expectedOperationTree = .Value Dim expectedDiagnostics = String.Empty @@ -174,6 +352,37 @@ IInvocationExpression ( Sub P.M2(x As System.Int32, ParamArray array As System.I VerifyOperationTreeAndDiagnosticsForTest(Of InvocationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + + Public Sub PositionalByRefModifiableArgumentWithConversion() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of InvocationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + End Class End Namespace -- GitLab