-
-
Notifications
You must be signed in to change notification settings - Fork 750
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1634426
commit d9b3a66
Showing
894 changed files
with
2,896 additions
and
4,276 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
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 |
---|---|---|
|
@@ -65,4 +65,4 @@ private static async Task FormatStreamAsync( | |
} | ||
} | ||
} | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
src/CookieCrumble/src/CookieCrumble/Formatters/IMarkdownSnapshotValueFormatter.cs
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,32 @@ | ||
using System.Buffers; | ||
|
||
namespace CookieCrumble.Formatters; | ||
|
||
/// <summary> | ||
/// Formats a snapshot segment value for the snapshot file. | ||
/// </summary> | ||
public interface IMarkdownSnapshotValueFormatter | ||
{ | ||
/// <summary> | ||
/// Specifies if the formatter can handle the snapshot segment value. | ||
/// </summary> | ||
/// <param name="value"> | ||
/// The snapshot segment value. | ||
/// </param> | ||
/// <returns> | ||
/// <c>true</c> if the formatter can handle the snapshot segment value; | ||
/// otherwise, <c>false</c>. | ||
/// </returns> | ||
bool CanHandle(object? value); | ||
|
||
/// <summary> | ||
/// Formats the specified snapshot segment value for the snapshot file. | ||
/// </summary> | ||
/// <param name="snapshot"> | ||
/// The snapshot file writer. | ||
/// </param> | ||
/// <param name="value"> | ||
/// The snapshot segment vale. | ||
/// </param> | ||
void FormatMarkdown(IBufferWriter<byte> snapshot, object? value); | ||
} |
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
33 changes: 33 additions & 0 deletions
33
src/CookieCrumble/src/CookieCrumble/Formatters/JsonElementSnapshotValueFormatter.cs
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,33 @@ | ||
using System.Buffers; | ||
using System.Text.Encodings.Web; | ||
using System.Text.Json; | ||
|
||
namespace CookieCrumble.Formatters; | ||
|
||
internal sealed class JsonElementSnapshotValueFormatter : SnapshotValueFormatter<JsonElement> | ||
{ | ||
private readonly JsonSerializerOptions _options = | ||
new(JsonSerializerDefaults.Web) | ||
{ | ||
WriteIndented = true, | ||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, | ||
}; | ||
|
||
protected override void Format(IBufferWriter<byte> snapshot, JsonElement value) | ||
{ | ||
var buffer = JsonSerializer.SerializeToUtf8Bytes(value, _options); | ||
var span = snapshot.GetSpan(buffer.Length); | ||
buffer.AsSpan().CopyTo(span); | ||
snapshot.Advance(buffer.Length); | ||
} | ||
|
||
protected override void FormatMarkdown(IBufferWriter<byte> snapshot, JsonElement value) | ||
{ | ||
snapshot.Append("```json"); | ||
snapshot.AppendLine(); | ||
Format(snapshot, value); | ||
snapshot.AppendLine(); | ||
snapshot.Append("```"); | ||
snapshot.AppendLine(); | ||
} | ||
} |
1 change: 0 additions & 1 deletion
1
src/CookieCrumble/src/CookieCrumble/Formatters/QueryPlanSnapshotValueFormatter.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
using System; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
using Xunit.Sdk; | ||
|
Oops, something went wrong.