Skip to content

Commit

Permalink
Merge pull request #6435 from huoyaoyuan/vulnerable-dependency
Browse files Browse the repository at this point in the history
Update transitive vulnerable dependencies for source generation tests
  • Loading branch information
smoogipoo authored Dec 3, 2024
2 parents 5743c6e + 9c8c791 commit f3f3f4a
Show file tree
Hide file tree
Showing 47 changed files with 65 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void Check(string name)

[Theory]
[MemberData(nameof(CheckWithStatisticsData))]
public void CheckWithStatistics(string name, (int, int, int)[] expectedStatistics)
public void CheckWithStatistics(string name, (int syntaxTargetCreated, int semanticTargetCreated, int emitHits)[] expectedStatistics)
{
GetTestSources(name,
out (string filename, string content)[] commonSources,
Expand Down
5 changes: 2 additions & 3 deletions osu.Framework.SourceGeneration.Tests/GeneratorTestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Testing;
using Microsoft.CodeAnalysis.Testing.Verifiers;

namespace osu.Framework.SourceGeneration.Tests
{
Expand Down Expand Up @@ -57,7 +56,7 @@ public static void VerifyMultiPhaseGeneratedSources(this GeneratorDriverRunResul

string actual = source.SourceText.ToString();

new XUnitVerifier().EqualOrDiff(content, actual, $"Phase {phase}: Generated source {filename} did not match expected content");
new DefaultVerifier().EqualOrDiff(content, actual, $"Phase {phase}: Generated source {filename} did not match expected content");

matches++;
}
Expand All @@ -77,7 +76,7 @@ public IncrementalCompilation()
{
Compilation = CSharpCompilation.Create("test",
references: new[] { MetadataReference.CreateFromFile(typeof(object).Assembly.Location) },
options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary));
options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel: OptimizationLevel.Release));
}

public GeneratorDriverRunResult RunGenerators(ref GeneratorDriver driver)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class AcceptsFocusProperty : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::AcceptsFocusProperty);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ namespace osu.Framework.Graphics
partial class Drawable : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::osu.Framework.Graphics.Drawable);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => false;

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
partial class HandleMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::HandleMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class HandleNonPositionalInputProperty : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::HandleNonPositionalInputProperty);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class HandlePositionalInputProperty : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::HandlePositionalInputProperty);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class IHasContextMenuInterface : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::IHasContextMenuInterface);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class IHasCustomTooltipInterface : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::IHasCustomTooltipInterface);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class IHasPopoverInterface : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::IHasPopoverInterface);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class IHasTooltipInterface : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::IHasTooltipInterface);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class IKeyBindingHandlerInterface : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::IKeyBindingHandlerInterface);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
partial class PartialClass : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::PartialClass);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnClickMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnClickMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnDoubleClickMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnDoubleClickMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnDragEndMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnDragEndMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnDragMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnDragMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnDragStartMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnDragStartMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
partial class OnFocusLostMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnFocusLostMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
partial class OnFocusMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnFocusMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnHoverLostMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnHoverLostMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnHoverMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnHoverMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnJoystickAxisMoveMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnJoystickAxisMoveMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnJoystickPressMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnJoystickPressMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnJoystickReleaseMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnJoystickReleaseMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnKeyDownMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnKeyDownMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnKeyUpMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnKeyUpMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnMidiDownMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnMidiDownMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnMidiUpMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnMidiUpMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnMouseDownMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnMouseDownMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnMouseMoveMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnMouseMoveMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnMouseUpMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnMouseUpMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnScrollMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnScrollMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnTabletAuxiliaryButtonPressMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnTabletAuxiliaryButtonPressMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnTabletAuxiliaryButtonReleaseMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnTabletAuxiliaryButtonReleaseMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsNonPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnTabletPenButtonPressMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnTabletPenButtonPressMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnTabletPenButtonReleaseMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnTabletPenButtonReleaseMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnTouchDownMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnTouchDownMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnTouchMoveMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnTouchMoveMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class OnTouchUpMethod : global::osu.Framework.Input.ISourceGeneratedHandleInputCache
{
global::System.Type global::osu.Framework.Input.ISourceGeneratedHandleInputCache.KnownType => typeof(global::OnTouchUpMethod);

bool global::osu.Framework.Input.ISourceGeneratedHandleInputCache.RequestsPositionalInput => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace osu.Framework.Graphics
partial class Drawable : global::osu.Framework.Allocation.ISourceGeneratedLongRunningLoadCache
{
global::System.Type global::osu.Framework.Allocation.ISourceGeneratedLongRunningLoadCache.KnownType => typeof(global::osu.Framework.Graphics.Drawable);

bool global::osu.Framework.Allocation.ISourceGeneratedLongRunningLoadCache.IsLongRunning => false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
partial class LongRunningType : global::osu.Framework.Allocation.ISourceGeneratedLongRunningLoadCache
{
global::System.Type global::osu.Framework.Allocation.ISourceGeneratedLongRunningLoadCache.KnownType => typeof(global::LongRunningType);

bool global::osu.Framework.Allocation.ISourceGeneratedLongRunningLoadCache.IsLongRunning => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public Test(
driver = CSharpGeneratorDriver.Create(generator = new TSourceGenerator());
driver = driver.WithUpdatedParseOptions(CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion));

generator.ForceRun = true;

this.commonSources = commonSources;
this.commonGenerated = commonGenerated;
this.multiPhaseSources = multiPhaseSources;
Expand Down
Loading

0 comments on commit f3f3f4a

Please sign in to comment.