-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Pizzaandy/source-text-abstraction
refactor: use SourceText instead of string, add tests
- Loading branch information
Showing
14 changed files
with
565 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
str = "\\"; | ||
|
||
var escaped_template = $"\{{a + b}\}"; | ||
|
||
var more_escapes = $"\"{link_list[link_index]}\""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
str = "\\" | ||
|
||
var escaped_template = $"\{{a+b}\}" | ||
var escaped_template = $"\{{a+b}\}" | ||
|
||
var more_escapes = $"\"{link_list[link_index]}\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Gobo.Text; | ||
using Xunit.Abstractions; | ||
using Xunit.Sdk; | ||
|
||
namespace Gobo.Tests; | ||
|
||
/// <summary> | ||
/// These tests ensure that implementations of SourceText work as expected on large files | ||
/// </summary> | ||
public class SourceTextTests | ||
{ | ||
private readonly ITestOutputHelper output; | ||
|
||
public const string TestFileExtension = ".test"; | ||
|
||
public SourceTextTests(ITestOutputHelper output) | ||
{ | ||
this.output = output; | ||
} | ||
|
||
[Theory] | ||
[ClassData(typeof(SampleFileProvider))] | ||
public async Task EnsureContentEquals(TestFile test) | ||
{ | ||
var filePath = test.FilePath; | ||
|
||
var input = await File.ReadAllTextAsync(filePath); | ||
var wrongInput = "obviously wrong input"; | ||
|
||
var sourceTextA = new StringText(input); | ||
var sourceTextB = new StringText(input); | ||
var sourceTextC = new StringText(wrongInput); | ||
|
||
if (!sourceTextA.ContentEquals(sourceTextB)) | ||
{ | ||
throw new XunitException($"Comparison failed"); | ||
} | ||
|
||
if (sourceTextA.ContentEquals(sourceTextC)) | ||
{ | ||
throw new XunitException($"Something has gone horribly wrong"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.