Update unit tests for 'preview' required
このコミットが含まれているのは:
1 親
f57bf4252a
コミット
bba179583f
4ファイル変更
+76
-36
検索条件に一致するファイルはありません
+30
-30
@@ -33,7 +33,7 @@ public class Test_CanvasEffectPropertyGenerator
|
||||
partial class MyEffect
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public partial int Number
|
||||
@@ -63,27 +63,27 @@ public class Test_CanvasEffectPropertyGenerator
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> is changing.</summary>
|
||||
/// <param name="value">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnNumberChanging(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> is changing.</summary>
|
||||
/// <param name="oldValue">The previous property value that is being replaced.</param>
|
||||
/// <param name="newValue">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnNumberChanging(int oldValue, int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> has just changed.</summary>
|
||||
/// <param name="value">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnNumberChanged(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> has just changed.</summary>
|
||||
/// <param name="oldValue">The previous property value that has been replaced.</param>
|
||||
/// <param name="newValue">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnNumberChanged(int oldValue, int newValue);
|
||||
}
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public class Test_CanvasEffectPropertyGenerator
|
||||
partial class MyEffect
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public partial object? Instance
|
||||
@@ -147,27 +147,27 @@ public class Test_CanvasEffectPropertyGenerator
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> is changing.</summary>
|
||||
/// <param name="value">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnInstanceChanging(object? newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> is changing.</summary>
|
||||
/// <param name="oldValue">The previous property value that is being replaced.</param>
|
||||
/// <param name="newValue">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnInstanceChanging(object? oldValue, object? newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> has just changed.</summary>
|
||||
/// <param name="value">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnInstanceChanged(object? newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> has just changed.</summary>
|
||||
/// <param name="oldValue">The previous property value that has been replaced.</param>
|
||||
/// <param name="newValue">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnInstanceChanged(object? oldValue, object? newValue);
|
||||
}
|
||||
}
|
||||
@@ -201,7 +201,7 @@ public class Test_CanvasEffectPropertyGenerator
|
||||
partial class MyEffect
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public partial object Instance
|
||||
@@ -231,27 +231,27 @@ public class Test_CanvasEffectPropertyGenerator
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> is changing.</summary>
|
||||
/// <param name="value">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnInstanceChanging(object newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> is changing.</summary>
|
||||
/// <param name="oldValue">The previous property value that is being replaced.</param>
|
||||
/// <param name="newValue">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnInstanceChanging(object? oldValue, object newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> has just changed.</summary>
|
||||
/// <param name="value">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnInstanceChanged(object newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> has just changed.</summary>
|
||||
/// <param name="oldValue">The previous property value that has been replaced.</param>
|
||||
/// <param name="newValue">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnInstanceChanged(object? oldValue, object newValue);
|
||||
}
|
||||
}
|
||||
@@ -285,7 +285,7 @@ public class Test_CanvasEffectPropertyGenerator
|
||||
partial class MyEffect
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public partial int Number
|
||||
@@ -315,27 +315,27 @@ public class Test_CanvasEffectPropertyGenerator
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> is changing.</summary>
|
||||
/// <param name="value">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnNumberChanging(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> is changing.</summary>
|
||||
/// <param name="oldValue">The previous property value that is being replaced.</param>
|
||||
/// <param name="newValue">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnNumberChanging(int oldValue, int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> has just changed.</summary>
|
||||
/// <param name="value">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnNumberChanged(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> has just changed.</summary>
|
||||
/// <param name="oldValue">The previous property value that has been replaced.</param>
|
||||
/// <param name="newValue">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnNumberChanged(int oldValue, int newValue);
|
||||
}
|
||||
}
|
||||
@@ -372,7 +372,7 @@ public class Test_CanvasEffectPropertyGenerator
|
||||
partial class MyEffect
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public partial int X
|
||||
@@ -400,7 +400,7 @@ public class Test_CanvasEffectPropertyGenerator
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public partial int Y
|
||||
@@ -430,53 +430,53 @@ public class Test_CanvasEffectPropertyGenerator
|
||||
/// <summary>Executes the logic for when <see cref="X"/> is changing.</summary>
|
||||
/// <param name="value">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="X"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnXChanging(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="X"/> is changing.</summary>
|
||||
/// <param name="oldValue">The previous property value that is being replaced.</param>
|
||||
/// <param name="newValue">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="X"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnXChanging(int oldValue, int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="X"/> has just changed.</summary>
|
||||
/// <param name="value">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="X"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnXChanged(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="X"/> has just changed.</summary>
|
||||
/// <param name="oldValue">The previous property value that has been replaced.</param>
|
||||
/// <param name="newValue">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="X"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnXChanged(int oldValue, int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Y"/> is changing.</summary>
|
||||
/// <param name="value">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Y"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnYChanging(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Y"/> is changing.</summary>
|
||||
/// <param name="oldValue">The previous property value that is being replaced.</param>
|
||||
/// <param name="newValue">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Y"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnYChanging(int oldValue, int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Y"/> has just changed.</summary>
|
||||
/// <param name="value">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Y"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnYChanged(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Y"/> has just changed.</summary>
|
||||
/// <param name="oldValue">The previous property value that has been replaced.</param>
|
||||
/// <param name="newValue">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Y"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", <ASSEMBLY_VERSION>)]
|
||||
partial void OnYChanged(int oldValue, int newValue);
|
||||
}
|
||||
}
|
||||
|
||||
+34
@@ -173,4 +173,38 @@ public class Test_CanvasEffectPropertyGenerator_Analyzers
|
||||
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGeneratedCanvasEffectPropertyDeclarationAnalyzer>.VerifyAnalyzerAsync(source, languageVersion: LanguageVersion.Preview);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task RequireCSharpLanguageVersionPreviewAnalyzer_LanguageVersionIsNotPreview_Warns()
|
||||
{
|
||||
const string source = """
|
||||
using System;
|
||||
using ComputeSharp.D2D1.WinUI;
|
||||
|
||||
public abstract partial class MyEffect : CanvasEffect
|
||||
{
|
||||
[{|CMPSD2DWINUI0007:GeneratedCanvasEffectProperty|}]
|
||||
public int Number { get; set; }
|
||||
}
|
||||
""";
|
||||
|
||||
await CSharpAnalyzerWithLanguageVersionTest<RequireCSharpLanguageVersionPreviewAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task RequireCSharpLanguageVersionPreviewAnalyzer_LanguageVersionIsPreview_DoesNotWarn()
|
||||
{
|
||||
const string source = """
|
||||
using System;
|
||||
using ComputeSharp.D2D1.WinUI;
|
||||
|
||||
public abstract partial class MyEffect : CanvasEffect
|
||||
{
|
||||
[GeneratedCanvasEffectProperty]
|
||||
public int Number { get; set; }
|
||||
}
|
||||
""";
|
||||
|
||||
await CSharpAnalyzerWithLanguageVersionTest<RequireCSharpLanguageVersionPreviewAnalyzer>.VerifyAnalyzerAsync(source, languageVersion: LanguageVersion.Preview);
|
||||
}
|
||||
}
|
||||
+7
-3
@@ -1,6 +1,7 @@
|
||||
using ComputeSharp.D2D1.WinUI.SourceGenerators;
|
||||
using ComputeSharp.Tests.SourceGenerators.Helpers;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ComputeSharp.D2D1.WinUI.Tests.SourceGenerators;
|
||||
@@ -38,7 +39,8 @@ public class Test_CanvasEffectPropertyGenerator_Incrementality
|
||||
diagnosticsReason: null,
|
||||
outputReason: IncrementalStepRunReason.Modified,
|
||||
diagnosticsSourceReason: null,
|
||||
sourceReason: IncrementalStepRunReason.Modified);
|
||||
sourceReason: IncrementalStepRunReason.Modified,
|
||||
languageVersion: LanguageVersion.Preview);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -74,7 +76,8 @@ public class Test_CanvasEffectPropertyGenerator_Incrementality
|
||||
diagnosticsReason: null,
|
||||
outputReason: IncrementalStepRunReason.Cached,
|
||||
diagnosticsSourceReason: null,
|
||||
sourceReason: IncrementalStepRunReason.Cached);
|
||||
sourceReason: IncrementalStepRunReason.Cached,
|
||||
languageVersion: LanguageVersion.Preview);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -111,6 +114,7 @@ public class Test_CanvasEffectPropertyGenerator_Incrementality
|
||||
diagnosticsReason: null,
|
||||
outputReason: IncrementalStepRunReason.Cached,
|
||||
diagnosticsSourceReason: null,
|
||||
sourceReason: IncrementalStepRunReason.Cached);
|
||||
sourceReason: IncrementalStepRunReason.Cached,
|
||||
languageVersion: LanguageVersion.Preview);
|
||||
}
|
||||
}
|
||||
@@ -83,6 +83,7 @@ internal static class CSharpGeneratorTest<TGenerator>
|
||||
/// <param name="outputReason">The reason for the <c>"Output"</c> step.</param>
|
||||
/// <param name="diagnosticsSourceReason">The reason for the output step for the diagnostics.</param>
|
||||
/// <param name="sourceReason">The reason for the final output source.</param>
|
||||
/// <param name="languageVersion">The language version to use to run the test.</param>
|
||||
public static void VerifyIncrementalSteps(
|
||||
string source,
|
||||
string updatedSource,
|
||||
@@ -90,9 +91,10 @@ internal static class CSharpGeneratorTest<TGenerator>
|
||||
IncrementalStepRunReason? diagnosticsReason,
|
||||
IncrementalStepRunReason outputReason,
|
||||
IncrementalStepRunReason? diagnosticsSourceReason,
|
||||
IncrementalStepRunReason sourceReason)
|
||||
IncrementalStepRunReason sourceReason,
|
||||
LanguageVersion languageVersion = LanguageVersion.CSharp12)
|
||||
{
|
||||
Compilation compilation = CreateCompilation(source);
|
||||
Compilation compilation = CreateCompilation(source, languageVersion);
|
||||
|
||||
GeneratorDriver driver = CSharpGeneratorDriver.Create(
|
||||
generators: [new TGenerator().AsSourceGenerator()],
|
||||
@@ -104,7 +106,7 @@ internal static class CSharpGeneratorTest<TGenerator>
|
||||
// Update the compilation by replacing the source
|
||||
compilation = compilation.ReplaceSyntaxTree(
|
||||
compilation.SyntaxTrees.First(),
|
||||
CSharpSyntaxTree.ParseText(updatedSource, CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp12)));
|
||||
CSharpSyntaxTree.ParseText(updatedSource, CSharpParseOptions.Default.WithLanguageVersion(languageVersion)));
|
||||
|
||||
// Run the generators again on the updated source
|
||||
driver = driver.RunGenerators(compilation);
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする