Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kzrnm committed Jan 2, 2025
1 parent fc38be6 commit df7243b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace SourceExpander.Generate.Config
{
public class ConfigTest : ExpandGeneratorTestBase
{
public static readonly TheoryData ParseErrorJsons = new TheoryData<InMemorySourceText, object[]>
public static readonly TheoryData<InMemorySourceText, object[]> ParseErrorJsons = new()
{
{
new InMemorySourceText("/foo/bar/SourceExpander.Generator.Config.json", """
Expand Down
12 changes: 4 additions & 8 deletions Test/Utils/InMemorySourceText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@

namespace SourceExpander
{
public class InMemorySourceText : AdditionalText
public class InMemorySourceText(string path, string source, Encoding encoding) : AdditionalText
{
public InMemorySourceText(string path, string source) : this(path, source, new UTF8Encoding(false)) { }
public InMemorySourceText(string path, string source, Encoding encoding)
{
Path = path;
sourceText = SourceText.From(source, encoding);
}
public override string Path { get; }
private readonly SourceText sourceText;

public override string Path { get; } = path;
private readonly SourceText sourceText = SourceText.From(source, encoding);
public override SourceText GetText(CancellationToken cancellationToken = default) => sourceText;
public static implicit operator (string filename, SourceText content)(InMemorySourceText at)
=> (at.Path, at.sourceText);
Expand Down

0 comments on commit df7243b

Please sign in to comment.