Skip to content

Commit

Permalink
Add [StringSyntax("C#-test")]
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Jul 25, 2024
1 parent 1761bb7 commit 58c5791
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Diagnostics;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.Loader;
using Xunit.Abstractions;
Expand Down Expand Up @@ -34,7 +35,7 @@ public static void InitializeCompilation()
baseCompilation = compilation;
}

public static (Compilation, ImmutableArray<Diagnostic>) RunGenerator(string source, string[]? preprocessorSymbols = null, AnalyzerConfigOptionsProvider? options = null)
public static (Compilation, ImmutableArray<Diagnostic>) RunGenerator([StringSyntax("C#-test")] string source, string[]? preprocessorSymbols = null, AnalyzerConfigOptionsProvider? options = null)
{
if (preprocessorSymbols == null)
{
Expand Down Expand Up @@ -139,7 +140,7 @@ public class VerifyHelper(ITestOutputHelper output, string idPrefix)
{
// Diagnostics Verify

public void Ok(string code, [CallerArgumentExpression("code")] string? codeExpr = null)
public void Ok([StringSyntax("C#-test")] string code, [CallerArgumentExpression("code")] string? codeExpr = null)
{
output.WriteLine(codeExpr);

Expand All @@ -153,7 +154,7 @@ public void Ok(string code, [CallerArgumentExpression("code")] string? codeExpr
diagnostics.Length.Should().Be(0);
}

public void Verify(int id, string code, string diagnosticsCodeSpan, [CallerArgumentExpression("code")] string? codeExpr = null)
public void Verify(int id, [StringSyntax("C#-test")] string code, string diagnosticsCodeSpan, [CallerArgumentExpression("code")] string? codeExpr = null)
{
output.WriteLine(codeExpr);

Expand All @@ -171,7 +172,7 @@ public void Verify(int id, string code, string diagnosticsCodeSpan, [CallerArgum
text.Should().Be(diagnosticsCodeSpan);
}

public (string, string)[] Verify(string code, [CallerArgumentExpression("code")] string? codeExpr = null)
public (string, string)[] Verify([StringSyntax("C#-test")] string code, [CallerArgumentExpression("code")] string? codeExpr = null)
{
output.WriteLine(codeExpr);

Expand All @@ -182,7 +183,7 @@ public void Verify(int id, string code, string diagnosticsCodeSpan, [CallerArgum

// Execute and check stdout result

public void Execute(string code, string args, string expected, [CallerArgumentExpression("code")] string? codeExpr = null)
public void Execute([StringSyntax("C#-test")]string code, string args, string expected, [CallerArgumentExpression("code")] string? codeExpr = null)
{
output.WriteLine(codeExpr);

Expand All @@ -196,7 +197,7 @@ public void Execute(string code, string args, string expected, [CallerArgumentEx
stdout.Should().Be(expected);
}

public string Error(string code, string args, [CallerArgumentExpression("code")] string? codeExpr = null)
public string Error([StringSyntax("C#-test")] string code, string args, [CallerArgumentExpression("code")] string? codeExpr = null)
{
output.WriteLine(codeExpr);

Expand Down

0 comments on commit 58c5791

Please sign in to comment.