Skip to content

Commit

Permalink
Merge pull request #6069 from Susko3/fix-params-testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
smoogipoo authored Dec 1, 2023
2 parents fe230a3 + 6a8f95a commit 99b7245
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions osu.Framework.Tests/Visual/Testing/TestSceneTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ public void TestTest()
[Repeat(2)]
public void TestTestCase(int _) => TestTest();

[TestCase(0)]
[TestCase(1, "one")]
[TestCase(3, "one", "two", "three")]
[TestCase(2, new[] { "test", "two" })]
public void TestParamsTestCase(int length, params string[] p)
{
TestTest();
AddAssert("params is array", () => p, Is.TypeOf<string[]>);
AddAssert("length is expected", () => p, () => Has.Length.EqualTo(length));
}

protected override ITestSceneTestRunner CreateRunner() => new TestRunner();

private partial class TestRunner : TestSceneTestRunner
Expand Down
2 changes: 1 addition & 1 deletion osu.Framework/Testing/TestBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ private void finishLoad(TestScene newTest, Action onCompletion)
hadTestAttributeTest = true;
CurrentTest.AddLabel($"{name}({string.Join(", ", tc.Arguments)}){repeatSuffix}");

handleTestMethod(m, tc.Arguments);
handleTestMethod(m, tc.BuildFrom(methodWrapper, null).Single().Arguments);
}

foreach (var tcs in m.GetCustomAttributes(typeof(TestCaseSourceAttribute), false).OfType<TestCaseSourceAttribute>())
Expand Down

0 comments on commit 99b7245

Please sign in to comment.