From 37b820b6700f3d94bbef8b5525bc51bb350e04f1 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 6 Jan 2024 23:41:13 +0100 Subject: [PATCH] Add InvalidD2DPixelShaderSourceAttributeUseAnalyzer test --- ...D2DPixelShaderSourceGenerator_Analyzers.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderSourceGenerator_Analyzers.cs b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderSourceGenerator_Analyzers.cs index a4fad771..840b9713 100644 --- a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderSourceGenerator_Analyzers.cs +++ b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderSourceGenerator_Analyzers.cs @@ -245,4 +245,23 @@ public class Test_D2DPixelShaderSourceGenerator_Analyzers await CSharpAnalyzerWithLanguageVersionTest.VerifyAnalyzerAsync(source); } + + [TestMethod] + public async Task InvalidD2DPixelShaderSource_NullArgument_Warns() + { + const string source = """ + using System; + using ComputeSharp.D2D1; + + public partial class MyClass + { + [D2DPixelShaderSource(null)] + public static partial ReadOnlySpan {|CMPSD2D0052:InvertEffect|}(); + + public static partial ReadOnlySpan InvertEffect() => default; + } + """; + + await CSharpAnalyzerWithLanguageVersionTest.VerifyAnalyzerAsync(source); + } } \ No newline at end of file