Skip to content

Commit

Permalink
Array syntax test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
inversionhourglass committed Oct 2, 2023
1 parent b272e9e commit f12d948
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/Rougamo.Fody.Tests/PatternTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,18 @@ public async Task MethodNestedTypeTest()
Assert.DoesNotContain(nameof(AnyDoubleDepthNestedTypeAttribute), executedMos);
}

[Fact]
public void MethodArrayTest()
{
var instance = GetInstance("Public");

var executedMos = new List<string>();

executedMos.Clear();
instance.PublicArray(executedMos);
Assert.Contains(nameof(IntArrayReturnAttribute), executedMos);
}

[Fact]
public void ParameterTest()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace PatternUsage.Attributes.Methods
{
public class IntArrayReturnAttribute : SetOnEntryAttribute
{
public override string? Pattern => "method(int[,][][,,] *(..))";
}
}
3 changes: 3 additions & 0 deletions test/TestAssemblies/PatternUsage/Public.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace PatternUsage
[IntAtTheLastOfThreeParameter]
[AnyTwoItemTupleParameter]
[SpecificTupleReturn]
[IntArrayReturn]
public class Public : NonPublicCaller, Interface, IRougamo<DoubleAtTheSecondOfThreeParameterAttribute>, IRougamo<InstanceAttribute>
{
public List<string> Prop1 { get; set; }
Expand Down Expand Up @@ -71,5 +72,7 @@ public void P3_3(List<string> executedMos, double a, int b) { }
await Task.Yield();
return default;
}

public int[,][][,,]? PublicArray(List<string> executedMos) => default;
}
}

0 comments on commit f12d948

Please sign in to comment.