Skip to content

Commit 69383a8

Browse files
committed
added failing test, repro confirmed #4921
1 parent 236492e commit 69383a8

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

RubberduckTests/Inspections/ParameterCanBeByValInspectionTests.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,6 +1575,30 @@ Private Sub abc_Foo(ByRef arg1 As Integer, ByRef arg2 As Integer)
15751575
}
15761576
}
15771577

1578+
[Test]
1579+
[Category("Inspections")]
1580+
public void ParameterCanBeByVal_EnumMemberParameterCanBeByVal()
1581+
{
1582+
//Input
1583+
const string inputCode = @"Option Explicit
1584+
Public Enum TestEnum
1585+
Foo
1586+
Bar
1587+
End Enum
1588+
1589+
Private Sub DoSomething(e As TestEnum)
1590+
Debug.Print e
1591+
End Sub";
1592+
1593+
var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out _);
1594+
using (var state = MockParser.CreateAndParse(vbe.Object))
1595+
{
1596+
var inspection = new ParameterCanBeByValInspection(state);
1597+
var inspectionResults = inspection.GetInspectionResults(CancellationToken.None);
1598+
1599+
Assert.AreEqual("e", inspectionResults.Single().Target.IdentifierName);
1600+
}
1601+
}
15781602
[Test]
15791603
[Category("Inspections")]
15801604
public void InspectionName()

0 commit comments

Comments
 (0)