Add Verify for testing

This commit is contained in:
Simon Cropp 2020-11-21 02:22:23 +11:00 committed by GitHub
parent aaf77c3b25
commit 5c33b87a9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
124 changed files with 992 additions and 822 deletions

View File

@ -82,4 +82,12 @@ jobs:
shell: bash
run: |
dotnet tool restore
dotnet cake
dotnet cake
- name: Upload Verify Test Results
if: failure()
uses: actions/upload-artifact@v2
with:
name: verify-test-results
path: |
**/*.received.*

2
.gitignore vendored
View File

@ -88,3 +88,5 @@ packages
# Windows
Thumbs.db
*.received.*

View File

@ -1,13 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net5.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net5.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
<PackageReference Include="Shouldly" Version="4.0.0-beta0002" />
<PackageReference Include="Verify.Xunit" Version="8.4.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
@ -19,4 +20,12 @@
<ProjectReference Include="..\Spectre.Console\Spectre.Console.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Unit\GridTests.TheAddEmptyRowMethod.Should_Add_Empty_Row.verified.txt">
<ParentFile>$([System.String]::Copy('%(FileName)').Split('.')[0])</ParentFile>
<ParentExtension>$(ProjectExt.Replace('proj', ''))</ParentExtension>
<DependentUpon>%(ParentFile)%(ParentExtension)</DependentUpon>
</None>
</ItemGroup>
</Project>

View File

@ -25,9 +25,8 @@ namespace Spectre.Console.Tests
public string Link { get; set; }
public StringWriter Writer { get; }
public string RawOutput => Writer.ToString();
public string Output => Writer.ToString().TrimEnd('\n');
public IReadOnlyList<string> Lines => Output.Split(new char[] { '\n' });
public string Output => Writer.ToString();
public IReadOnlyList<string> Lines => Output.TrimEnd('\n').Split(new char[] { '\n' });
public PlainConsole(
int width = 80, int height = 9000, Encoding encoding = null,
@ -61,15 +60,13 @@ namespace Spectre.Console.Tests
Writer.Write(segment.Text);
}
public string[] WriteExceptionAndGetLines(Exception ex, ExceptionFormats formats = ExceptionFormats.Default)
public string WriteNormalizedException(Exception ex, ExceptionFormats formats = ExceptionFormats.Default)
{
this.WriteException(ex, formats);
return Output.NormalizeStackTrace()
return string.Join("\n", Output.NormalizeStackTrace()
.NormalizeLineEndings()
.Split(new char[] { '\n' })
.Select(line => line.TrimEnd())
.ToArray();
.Select(line => line.TrimEnd()));
}
}
}

View File

@ -0,0 +1,3 @@
+-Greeting----+
| Hello World |
+-------------+

View File

@ -0,0 +1,3 @@
╔═Greeting════╗
║ Hello World ║
╚═════════════╝

View File

@ -0,0 +1,3 @@
┏━Greeting━━━━┓
┃ Hello World ┃
┗━━━━━━━━━━━━━┛

View File

@ -0,0 +1,3 @@
Greeting
Hello World

View File

@ -0,0 +1,3 @@
╭─Greeting────╮
│ Hello World │
╰─────────────╯

View File

@ -0,0 +1,3 @@
┌─Greeting────┐
│ Hello World │
└─────────────┘

View File

@ -1,11 +1,15 @@
using System.Threading.Tasks;
using Shouldly;
using Spectre.Console.Rendering;
using VerifyXunit;
using Xunit;
namespace Spectre.Console.Tests.Unit
{
[UsesVerify]
public sealed class BoxBorderTests
{
[UsesVerify]
public sealed class NoBorder
{
public sealed class TheSafeGetBorderMethod
@ -22,7 +26,7 @@ namespace Spectre.Console.Tests.Unit
}
[Fact]
public void Should_Render_As_Expected()
public Task Should_Render_As_Expected()
{
// Given
var console = new PlainConsole();
@ -32,13 +36,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(panel);
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe(" Greeting ");
console.Lines[1].ShouldBe(" Hello World ");
console.Lines[2].ShouldBe(" ");
return Verifier.Verify(console.Output);
}
}
[UsesVerify]
public sealed class AsciiBorder
{
public sealed class TheSafeGetBorderMethod
@ -55,7 +57,7 @@ namespace Spectre.Console.Tests.Unit
}
[Fact]
public void Should_Render_As_Expected()
public Task Should_Render_As_Expected()
{
// Given
var console = new PlainConsole();
@ -65,13 +67,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(panel);
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("+-Greeting----+");
console.Lines[1].ShouldBe("| Hello World |");
console.Lines[2].ShouldBe("+-------------+");
return Verifier.Verify(console.Output);
}
}
[UsesVerify]
public sealed class DoubleBorder
{
public sealed class TheSafeGetBorderMethod
@ -88,7 +88,7 @@ namespace Spectre.Console.Tests.Unit
}
[Fact]
public void Should_Render_As_Expected()
public Task Should_Render_As_Expected()
{
// Given
var console = new PlainConsole();
@ -98,13 +98,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(panel);
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("╔═Greeting════╗");
console.Lines[1].ShouldBe("║ Hello World ║");
console.Lines[2].ShouldBe("╚═════════════╝");
return Verifier.Verify(console.Output);
}
}
[UsesVerify]
public sealed class HeavyBorder
{
public sealed class TheSafeGetBorderMethod
@ -121,7 +119,7 @@ namespace Spectre.Console.Tests.Unit
}
[Fact]
public void Should_Render_As_Expected()
public Task Should_Render_As_Expected()
{
// Given
var console = new PlainConsole();
@ -131,13 +129,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(panel);
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("┏━Greeting━━━━┓");
console.Lines[1].ShouldBe("┃ Hello World ┃");
console.Lines[2].ShouldBe("┗━━━━━━━━━━━━━┛");
return Verifier.Verify(console.Output);
}
}
[UsesVerify]
public sealed class RoundedBorder
{
[Fact]
@ -151,7 +147,7 @@ namespace Spectre.Console.Tests.Unit
}
[Fact]
public void Should_Render_As_Expected()
public Task Should_Render_As_Expected()
{
// Given
var console = new PlainConsole();
@ -161,13 +157,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(panel);
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("╭─Greeting────╮");
console.Lines[1].ShouldBe("│ Hello World │");
console.Lines[2].ShouldBe("╰─────────────╯");
return Verifier.Verify(console.Output);
}
}
[UsesVerify]
public sealed class SquareBorder
{
[Fact]
@ -181,7 +175,7 @@ namespace Spectre.Console.Tests.Unit
}
[Fact]
public void Should_Render_As_Expected()
public Task Should_Render_As_Expected()
{
// Given
var console = new PlainConsole();
@ -191,10 +185,7 @@ namespace Spectre.Console.Tests.Unit
console.Render(panel);
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("┌─Greeting────┐");
console.Lines[1].ShouldBe("│ Hello World │");
console.Lines[2].ShouldBe("└─────────────┘");
return Verifier.Verify(console.Output);
}
}

View File

@ -0,0 +1,11 @@
2020 October
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
│ │ │ │ │ 1 │ 2 │ 3* │
│ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │
│ 11 │ 12* │ 13 │ 14 │ 15 │ 16 │ 17 │
│ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │
│ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │
│ │ │ │ │ │ │ │
└─────┴─────┴─────┴─────┴─────┴─────┴─────┘

View File

@ -0,0 +1,11 @@
2020 October
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
│ │ │ │ │ 1 │ 2 │ 3* │
│ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │
│ 11 │ 12* │ 13 │ 14 │ 15 │ 16 │ 17 │
│ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │
│ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │
│ │ │ │ │ │ │ │
└─────┴─────┴─────┴─────┴─────┴─────┴─────┘

View File

@ -0,0 +1,11 @@
2020 October
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
│ │ │ │ │ 1 │ 2 │ 3* │
│ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │
│ 11 │ 12* │ 13 │ 14 │ 15 │ 16 │ 17 │
│ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │
│ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │
│ │ │ │ │ │ │ │
└─────┴─────┴─────┴─────┴─────┴─────┴─────┘

View File

@ -0,0 +1,11 @@
Oktober 2020
┌─────┬────┬────┬────┬────┬────┬────┐
│ Mo │ Di │ Mi │ Do │ Fr │ Sa │ So │
├─────┼────┼────┼────┼────┼────┼────┤
│ │ │ │ 1 │ 2 │ 3* │ 4 │
│ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │
│ 12* │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │
│ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │
│ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │ │
│ │ │ │ │ │ │ │
└─────┴────┴────┴────┴────┴────┴────┘

View File

@ -0,0 +1,11 @@
2020 October
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
│ │ │ │ │ 1 │ 2 │ 3* │
│ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │
│ 11 │ 12* │ 13 │ 14 │ 15 │ 16 │ 17 │
│ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │
│ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │
│ │ │ │ │ │ │ │
└─────┴─────┴─────┴─────┴─────┴─────┴─────┘

View File

@ -1,13 +1,15 @@
using System;
using Shouldly;
using System.Threading.Tasks;
using VerifyXunit;
using Xunit;
namespace Spectre.Console.Tests.Unit
{
[UsesVerify]
public sealed class CalendarTests
{
[Fact]
public void Should_Render_Calendar_Correctly()
public Task Should_Render_Calendar_Correctly()
{
// Given
var console = new PlainConsole(width: 80);
@ -20,22 +22,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(calendar);
// Then
console.Lines.Count.ShouldBe(11);
console.Lines[00].ShouldBe(" 2020 October ");
console.Lines[01].ShouldBe("┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐");
console.Lines[02].ShouldBe("│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │");
console.Lines[03].ShouldBe("├─────┼─────┼─────┼─────┼─────┼─────┼─────┤");
console.Lines[04].ShouldBe("│ │ │ │ │ 1 │ 2 │ 3* │");
console.Lines[05].ShouldBe("│ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │");
console.Lines[06].ShouldBe("│ 11 │ 12* │ 13 │ 14 │ 15 │ 16 │ 17 │");
console.Lines[07].ShouldBe("│ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │");
console.Lines[08].ShouldBe("│ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │");
console.Lines[09].ShouldBe("│ │ │ │ │ │ │ │");
console.Lines[10].ShouldBe("└─────┴─────┴─────┴─────┴─────┴─────┴─────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Center_Calendar_Correctly()
public Task Should_Center_Calendar_Correctly()
{
// Given
var console = new PlainConsole(width: 80);
@ -49,22 +40,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(calendar);
// Then
console.Lines.Count.ShouldBe(11);
console.Lines[00].ShouldBe(" 2020 October ");
console.Lines[01].ShouldBe(" ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐ ");
console.Lines[02].ShouldBe(" │ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │ ");
console.Lines[03].ShouldBe(" ├─────┼─────┼─────┼─────┼─────┼─────┼─────┤ ");
console.Lines[04].ShouldBe(" │ │ │ │ │ 1 │ 2 │ 3* │ ");
console.Lines[05].ShouldBe(" │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ ");
console.Lines[06].ShouldBe(" │ 11 │ 12* │ 13 │ 14 │ 15 │ 16 │ 17 │ ");
console.Lines[07].ShouldBe(" │ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ ");
console.Lines[08].ShouldBe(" │ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │ ");
console.Lines[09].ShouldBe(" │ │ │ │ │ │ │ │ ");
console.Lines[10].ShouldBe(" └─────┴─────┴─────┴─────┴─────┴─────┴─────┘ ");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Left_Align_Calendar_Correctly()
public Task Should_Left_Align_Calendar_Correctly()
{
// Given
var console = new PlainConsole(width: 80);
@ -78,22 +58,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(calendar);
// Then
console.Lines.Count.ShouldBe(11);
console.Lines[00].ShouldBe(" 2020 October ");
console.Lines[01].ShouldBe("┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐");
console.Lines[02].ShouldBe("│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │");
console.Lines[03].ShouldBe("├─────┼─────┼─────┼─────┼─────┼─────┼─────┤");
console.Lines[04].ShouldBe("│ │ │ │ │ 1 │ 2 │ 3* │");
console.Lines[05].ShouldBe("│ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │");
console.Lines[06].ShouldBe("│ 11 │ 12* │ 13 │ 14 │ 15 │ 16 │ 17 │");
console.Lines[07].ShouldBe("│ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │");
console.Lines[08].ShouldBe("│ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │");
console.Lines[09].ShouldBe("│ │ │ │ │ │ │ │");
console.Lines[10].ShouldBe("└─────┴─────┴─────┴─────┴─────┴─────┴─────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Right_Align_Calendar_Correctly()
public Task Should_Right_Align_Calendar_Correctly()
{
// Given
var console = new PlainConsole(width: 80);
@ -107,22 +76,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(calendar);
// Then
console.Lines.Count.ShouldBe(11);
console.Lines[00].ShouldBe(" 2020 October ");
console.Lines[01].ShouldBe(" ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐");
console.Lines[02].ShouldBe(" │ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │");
console.Lines[03].ShouldBe(" ├─────┼─────┼─────┼─────┼─────┼─────┼─────┤");
console.Lines[04].ShouldBe(" │ │ │ │ │ 1 │ 2 │ 3* │");
console.Lines[05].ShouldBe(" │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │");
console.Lines[06].ShouldBe(" │ 11 │ 12* │ 13 │ 14 │ 15 │ 16 │ 17 │");
console.Lines[07].ShouldBe(" │ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │");
console.Lines[08].ShouldBe(" │ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │");
console.Lines[09].ShouldBe(" │ │ │ │ │ │ │ │");
console.Lines[10].ShouldBe(" └─────┴─────┴─────┴─────┴─────┴─────┴─────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Calendar_Correctly_For_Specific_Culture()
public Task Should_Render_Calendar_Correctly_For_Specific_Culture()
{
// Given
var console = new PlainConsole(width: 80);
@ -136,18 +94,7 @@ namespace Spectre.Console.Tests.Unit
console.Render(calendar);
// Then
console.Lines.Count.ShouldBe(11);
console.Lines[00].ShouldBe(" Oktober 2020 ");
console.Lines[01].ShouldBe("┌─────┬────┬────┬────┬────┬────┬────┐");
console.Lines[02].ShouldBe("│ Mo │ Di │ Mi │ Do │ Fr │ Sa │ So │");
console.Lines[03].ShouldBe("├─────┼────┼────┼────┼────┼────┼────┤");
console.Lines[04].ShouldBe("│ │ │ │ 1 │ 2 │ 3* │ 4 │");
console.Lines[05].ShouldBe("│ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │");
console.Lines[06].ShouldBe("│ 12* │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │");
console.Lines[07].ShouldBe("│ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │");
console.Lines[08].ShouldBe("│ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │ │");
console.Lines[09].ShouldBe("│ │ │ │ │ │ │ │");
console.Lines[10].ShouldBe("└─────┴────┴────┴────┴────┴────┴────┘");
return Verifier.Verify(console.Output);
}
}
}

View File

@ -0,0 +1,4 @@
╭────────────────────╮ ╭────────────────╮ ╭─────────────────╮
│ Savannah Thompson │ │ Sophie Ramos │ │ Katrin Goldberg │
│ Australia │ │ United States │ │ Germany │
╰────────────────────╯ ╰────────────────╯ ╰─────────────────╯

View File

@ -1,9 +1,11 @@
using System.Collections.Generic;
using Shouldly;
using System.Threading.Tasks;
using VerifyXunit;
using Xunit;
namespace Spectre.Console.Tests.Unit
{
[UsesVerify]
public sealed class ColumnsTests
{
private sealed class User
@ -13,7 +15,7 @@ namespace Spectre.Console.Tests.Unit
}
[Fact]
public void Should_Render_Columns_Correctly()
public Task Should_Render_Columns_Correctly()
{
// Given
var console = new PlainConsole(width: 61);
@ -36,11 +38,7 @@ namespace Spectre.Console.Tests.Unit
console.Render(new Columns(cards));
// Then
console.Lines.Count.ShouldBe(4);
console.Lines[0].ShouldBe("╭────────────────────╮ ╭────────────────╮ ╭─────────────────╮");
console.Lines[1].ShouldBe("│ Savannah Thompson │ │ Sophie Ramos │ │ Katrin Goldberg │");
console.Lines[2].ShouldBe("│ Australia │ │ United States │ │ Germany │");
console.Lines[3].ShouldBe("╰────────────────────╯ ╰────────────────╯ ╰─────────────────╯");
return Verifier.Verify(console.Output);
}
}
}

View File

@ -0,0 +1,4 @@
System.InvalidOperationException: Throwing!
at Spectre.Console.Tests.Data.TestExceptions.MethodThatThrows(Nullable`1 number) in /xyz/Exceptions.cs:nn
at Spectre.Console.Tests.Unit.ExceptionTests.<>c.<Should_Write_Exception>b__0_0() in /xyz/ExceptionTests.cs:nn
at Spectre.Console.Tests.Unit.ExceptionTests.GetException(Action action) in /xyz/ExceptionTests.cs:nn

View File

@ -0,0 +1,7 @@
System.InvalidOperationException: Something threw!
System.InvalidOperationException: Throwing!
at Spectre.Console.Tests.Data.TestExceptions.MethodThatThrows(Nullable`1 number) in /xyz/Exceptions.cs:nn
at Spectre.Console.Tests.Data.TestExceptions.ThrowWithInnerException() in /xyz/Exceptions.cs:nn
at Spectre.Console.Tests.Data.TestExceptions.ThrowWithInnerException() in /xyz/Exceptions.cs:nn
at Spectre.Console.Tests.Unit.ExceptionTests.<>c.<Should_Write_Exception_With_Inner_Exception>b__3_0() in /xyz/ExceptionTests.cs:nn
at Spectre.Console.Tests.Unit.ExceptionTests.GetException(Action action) in /xyz/ExceptionTests.cs:nn

View File

@ -0,0 +1,4 @@
System.InvalidOperationException: Throwing!
at MethodThatThrows(Nullable`1 number) in /xyz/Exceptions.cs:nn
at <Should_Write_Exception_With_Shortened_Methods>b__2_0() in /xyz/ExceptionTests.cs:nn
at GetException(Action action) in /xyz/ExceptionTests.cs:nn

View File

@ -0,0 +1,4 @@
InvalidOperationException: Throwing!
at Spectre.Console.Tests.Data.TestExceptions.MethodThatThrows(Nullable`1 number) in /xyz/Exceptions.cs:nn
at Spectre.Console.Tests.Unit.ExceptionTests.<>c.<Should_Write_Exception_With_Shortened_Types>b__1_0() in /xyz/ExceptionTests.cs:nn
at Spectre.Console.Tests.Unit.ExceptionTests.GetException(Action action) in /xyz/ExceptionTests.cs:nn

View File

@ -1,85 +1,68 @@
using System;
using Shouldly;
using System.Threading.Tasks;
using Spectre.Console.Tests.Data;
using VerifyXunit;
using Xunit;
namespace Spectre.Console.Tests.Unit
{
[UsesVerify]
public sealed class ExceptionTests
{
[Fact]
public void Should_Write_Exception()
public Task Should_Write_Exception()
{
// Given
var console = new PlainConsole(width: 1024);
var dex = GetException(() => TestExceptions.MethodThatThrows(null));
// When
var result = console.WriteExceptionAndGetLines(dex);
var result = console.WriteNormalizedException(dex);
// Then
result.Length.ShouldBe(4);
result[0].ShouldBe("System.InvalidOperationException: Throwing!");
result[1].ShouldBe(" at Spectre.Console.Tests.Data.TestExceptions.MethodThatThrows(Nullable`1 number) in /xyz/Exceptions.cs:nn");
result[2].ShouldBe(" at Spectre.Console.Tests.Unit.ExceptionTests.<>c.<Should_Write_Exception>b__0_0() in /xyz/ExceptionTests.cs:nn");
result[3].ShouldBe(" at Spectre.Console.Tests.Unit.ExceptionTests.GetException(Action action) in /xyz/ExceptionTests.cs:nn");
return Verifier.Verify(result);
}
[Fact]
public void Should_Write_Exception_With_Shortened_Types()
public Task Should_Write_Exception_With_Shortened_Types()
{
// Given
var console = new PlainConsole(width: 1024);
var dex = GetException(() => TestExceptions.MethodThatThrows(null));
// When
var result = console.WriteExceptionAndGetLines(dex, ExceptionFormats.ShortenTypes);
var result = console.WriteNormalizedException(dex, ExceptionFormats.ShortenTypes);
// Then
result.Length.ShouldBe(4);
result[0].ShouldBe("InvalidOperationException: Throwing!");
result[1].ShouldBe(" at Spectre.Console.Tests.Data.TestExceptions.MethodThatThrows(Nullable`1 number) in /xyz/Exceptions.cs:nn");
result[2].ShouldBe(" at Spectre.Console.Tests.Unit.ExceptionTests.<>c.<Should_Write_Exception_With_Shortened_Types>b__1_0() in /xyz/ExceptionTests.cs:nn");
result[3].ShouldBe(" at Spectre.Console.Tests.Unit.ExceptionTests.GetException(Action action) in /xyz/ExceptionTests.cs:nn");
return Verifier.Verify(result);
}
[Fact]
public void Should_Write_Exception_With_Shortened_Methods()
public Task Should_Write_Exception_With_Shortened_Methods()
{
// Given
var console = new PlainConsole(width: 1024);
var dex = GetException(() => TestExceptions.MethodThatThrows(null));
// When
var result = console.WriteExceptionAndGetLines(dex, ExceptionFormats.ShortenMethods);
var result = console.WriteNormalizedException(dex, ExceptionFormats.ShortenMethods);
// Then
result.Length.ShouldBe(4);
result[0].ShouldBe("System.InvalidOperationException: Throwing!");
result[1].ShouldBe(" at MethodThatThrows(Nullable`1 number) in /xyz/Exceptions.cs:nn");
result[2].ShouldBe(" at <Should_Write_Exception_With_Shortened_Methods>b__2_0() in /xyz/ExceptionTests.cs:nn");
result[3].ShouldBe(" at GetException(Action action) in /xyz/ExceptionTests.cs:nn");
return Verifier.Verify(result);
}
[Fact]
public void Should_Write_Exception_With_Inner_Exception()
public Task Should_Write_Exception_With_Inner_Exception()
{
// Given
var console = new PlainConsole(width: 1024);
var dex = GetException(() => TestExceptions.ThrowWithInnerException());
// When
var result = console.WriteExceptionAndGetLines(dex);
var result = console.WriteNormalizedException(dex);
// Then
result.Length.ShouldBe(7);
result[0].ShouldBe("System.InvalidOperationException: Something threw!");
result[1].ShouldBe(" System.InvalidOperationException: Throwing!");
result[2].ShouldBe(" at Spectre.Console.Tests.Data.TestExceptions.MethodThatThrows(Nullable`1 number) in /xyz/Exceptions.cs:nn");
result[3].ShouldBe(" at Spectre.Console.Tests.Data.TestExceptions.ThrowWithInnerException() in /xyz/Exceptions.cs:nn");
result[4].ShouldBe(" at Spectre.Console.Tests.Data.TestExceptions.ThrowWithInnerException() in /xyz/Exceptions.cs:nn");
result[5].ShouldBe(" at Spectre.Console.Tests.Unit.ExceptionTests.<>c.<Should_Write_Exception_With_Inner_Exception>b__3_0() in /xyz/ExceptionTests.cs:nn");
result[6].ShouldBe(" at Spectre.Console.Tests.Unit.ExceptionTests.GetException(Action action) in /xyz/ExceptionTests.cs:nn");
return Verifier.Verify(result);
}
public static Exception GetException(Action action)

View File

@ -0,0 +1,3 @@
Foo Bar Baz
Qux Corgi Waldo
GraultGarplyFred

View File

@ -0,0 +1,4 @@
Options
-h, --help Show command line help.
-c, --configuration The configuration to run for.
The default for most projects is Debug.

View File

@ -0,0 +1,3 @@
Foo Bar Baz
Qux Corgi Waldo
Grault Garply Fred

View File

@ -0,0 +1,2 @@
Qux Corgi Waldo
Grault Garply Fred

View File

@ -0,0 +1,3 @@
Foo Bar Baz
Qux Corgi Waldo
Grault Garply Fred

View File

@ -1,9 +1,12 @@
using System;
using System.Threading.Tasks;
using Shouldly;
using VerifyXunit;
using Xunit;
namespace Spectre.Console.Tests.Unit
{
[UsesVerify]
public sealed class GridTests
{
public sealed class TheAddColumnMethod
@ -72,10 +75,11 @@ namespace Spectre.Console.Tests.Unit
}
}
[UsesVerify]
public sealed class TheAddEmptyRowMethod
{
[Fact]
public void Should_Add_Empty_Row()
public Task Should_Add_Empty_Row()
{
// Given
var console = new PlainConsole(width: 80);
@ -89,14 +93,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(grid);
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("Foo Bar ");
console.Lines[1].ShouldBe(" ");
console.Lines[2].ShouldBe("Qux Corgi");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Add_Empty_Row_At_The_End()
public Task Should_Add_Empty_Row_At_The_End()
{
// Given
var console = new PlainConsole(width: 80);
@ -111,16 +112,12 @@ namespace Spectre.Console.Tests.Unit
console.Render(grid);
// Then
console.Lines.Count.ShouldBe(4);
console.Lines[0].ShouldBe("Foo Bar ");
console.Lines[1].ShouldBe(" ");
console.Lines[2].ShouldBe("Qux Corgi");
console.Lines[3].ShouldBe(" ");
return Verifier.Verify(console.Output);
}
}
[Fact]
public void Should_Render_Grid_Correctly()
public Task Should_Render_Grid_Correctly()
{
// Given
var console = new PlainConsole(width: 80);
@ -135,13 +132,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(grid);
// Then
console.Lines.Count.ShouldBe(2);
console.Lines[0].ShouldBe("Qux Corgi Waldo");
console.Lines[1].ShouldBe("Grault Garply Fred ");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Grid_Column_Alignment_Correctly()
public Task Should_Render_Grid_Column_Alignment_Correctly()
{
// Given
var console = new PlainConsole(width: 80);
@ -157,14 +152,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(grid);
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe(" Foo Bar Baz ");
console.Lines[1].ShouldBe(" Qux Corgi Waldo");
console.Lines[2].ShouldBe("Grault Garply Fred ");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Use_Default_Padding()
public Task Should_Use_Default_Padding()
{
// Given
var console = new PlainConsole(width: 80);
@ -178,14 +170,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(grid);
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("Foo Bar Baz ");
console.Lines[1].ShouldBe("Qux Corgi Waldo");
console.Lines[2].ShouldBe("Grault Garply Fred ");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Explicit_Grid_Column_Padding_Correctly()
public Task Should_Render_Explicit_Grid_Column_Padding_Correctly()
{
// Given
var console = new PlainConsole(width: 80);
@ -201,14 +190,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(grid);
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe(" Foo Bar Baz ");
console.Lines[1].ShouldBe(" Qux Corgi Waldo ");
console.Lines[2].ShouldBe(" GraultGarplyFred ");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Grid()
public Task Should_Render_Grid()
{
var console = new PlainConsole(width: 80);
var grid = new Grid();
@ -222,11 +208,7 @@ namespace Spectre.Console.Tests.Unit
console.Render(grid);
// Then
console.Lines.Count.ShouldBe(4);
console.Lines[0].ShouldBe("Options ");
console.Lines[1].ShouldBe(" -h, --help Show command line help. ");
console.Lines[2].ShouldBe(" -c, --configuration The configuration to run for. ");
console.Lines[3].ShouldBe(" The default for most projects is Debug.");
return Verifier.Verify(console.Output);
}
}
}

View File

@ -0,0 +1,12 @@
┌───────┬───────┐
│ Foo │ Bar │
├───────┼───────┤
│ Baz │ Qux │
│ Corgi │ Waldo │
└───────┴───────┘

View File

@ -0,0 +1,12 @@
┌───────┬───────┐
│ Foo │ Bar │
├───────┼───────┤
│ Baz │ Qux │
│ Corgi │ Waldo │
└───────┴───────┘

View File

@ -0,0 +1,16 @@
┌───────┬─────────────┐
│ Foo │Bar │
├───────┼─────────────┤
│ Baz │Qux │
│ Corgi │ │
│ │ ┌───────┐ │
│ │ │ Waldo │ │
│ │ └───────┘ │
│ │ │
└───────┴─────────────┘

View File

@ -1,12 +1,14 @@
using Shouldly;
using System.Threading.Tasks;
using VerifyXunit;
using Xunit;
namespace Spectre.Console.Tests.Unit
{
[UsesVerify]
public sealed class PadderTests
{
[Fact]
public void Should_Render_Padded_Object_Correctly()
public Task Should_Render_Padded_Object_Correctly()
{
// Given
var console = new PlainConsole(width: 60);
@ -20,23 +22,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(new Padder(table).Padding(1, 2, 3, 4));
// Then
console.Lines.Count.ShouldBe(12);
console.Lines[00].ShouldBe(" ");
console.Lines[01].ShouldBe(" ");
console.Lines[02].ShouldBe(" ┌───────┬───────┐ ");
console.Lines[03].ShouldBe(" │ Foo │ Bar │ ");
console.Lines[04].ShouldBe(" ├───────┼───────┤ ");
console.Lines[05].ShouldBe(" │ Baz │ Qux │ ");
console.Lines[06].ShouldBe(" │ Corgi │ Waldo │ ");
console.Lines[07].ShouldBe(" └───────┴───────┘ ");
console.Lines[08].ShouldBe(" ");
console.Lines[09].ShouldBe(" ");
console.Lines[10].ShouldBe(" ");
console.Lines[11].ShouldBe(" ");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Expanded_Padded_Object_Correctly()
public Task Should_Render_Expanded_Padded_Object_Correctly()
{
// Given
var console = new PlainConsole(width: 60);
@ -52,23 +42,11 @@ namespace Spectre.Console.Tests.Unit
.Expand());
// Then
console.Lines.Count.ShouldBe(12);
console.Lines[00].ShouldBe(" ");
console.Lines[01].ShouldBe(" ");
console.Lines[02].ShouldBe(" ┌───────┬───────┐ ");
console.Lines[03].ShouldBe(" │ Foo │ Bar │ ");
console.Lines[04].ShouldBe(" ├───────┼───────┤ ");
console.Lines[05].ShouldBe(" │ Baz │ Qux │ ");
console.Lines[06].ShouldBe(" │ Corgi │ Waldo │ ");
console.Lines[07].ShouldBe(" └───────┴───────┘ ");
console.Lines[08].ShouldBe(" ");
console.Lines[09].ShouldBe(" ");
console.Lines[10].ShouldBe(" ");
console.Lines[11].ShouldBe(" ");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Padded_Object_Correctly_When_Nested_Within_Other_Object()
public Task Should_Render_Padded_Object_Correctly_When_Nested_Within_Other_Object()
{
// Given
var console = new PlainConsole(width: 60);
@ -85,23 +63,7 @@ namespace Spectre.Console.Tests.Unit
.Expand());
// Then
console.Lines.Count.ShouldBe(16);
console.Lines[00].ShouldBe(" ");
console.Lines[01].ShouldBe(" ");
console.Lines[02].ShouldBe(" ┌───────┬─────────────┐ ");
console.Lines[03].ShouldBe(" │ Foo │Bar │ ");
console.Lines[04].ShouldBe(" ├───────┼─────────────┤ ");
console.Lines[05].ShouldBe(" │ Baz │Qux │ ");
console.Lines[06].ShouldBe(" │ Corgi │ │ ");
console.Lines[07].ShouldBe(" │ │ ┌───────┐ │ ");
console.Lines[08].ShouldBe(" │ │ │ Waldo │ │ ");
console.Lines[09].ShouldBe(" │ │ └───────┘ │ ");
console.Lines[10].ShouldBe(" │ │ │ ");
console.Lines[11].ShouldBe(" └───────┴─────────────┘ ");
console.Lines[12].ShouldBe(" ");
console.Lines[13].ShouldBe(" ");
console.Lines[14].ShouldBe(" ");
console.Lines[15].ShouldBe(" ");
return Verifier.Verify(console.Output);
}
}
}

View File

@ -0,0 +1,3 @@
┌───────────────────────┐
│ Hello World │
└───────────────────────┘

View File

@ -0,0 +1,4 @@
┌─Greet…─┐
│ Hello │
│ World │
└────────┘

View File

@ -0,0 +1,3 @@
┌──────────────────────────────────────────────────────────────────────────────┐
│ Hello World │
└──────────────────────────────────────────────────────────────────────────────┘

View File

@ -0,0 +1,3 @@
┌───────────────────────┐
│ Hello World │
└───────────────────────┘

View File

@ -0,0 +1,7 @@
┌───────────────────────┐
│ I heard you like 📦 │
│ │
│ │
│ │
│ So I put a 📦 in a 📦 │
└───────────────────────┘

View File

@ -0,0 +1,3 @@
┌─────────────┐
│ Hello World │
└─────────────┘

View File

@ -0,0 +1,5 @@
┌─────────────────┐
│ ┌─────────────┐ │
│ │ Hello World │ │
│ └─────────────┘ │
└─────────────────┘

View File

@ -0,0 +1,3 @@
┌───────────────────────────────────Greeting───────────────────────────────────┐
│ Hello World │
└──────────────────────────────────────────────────────────────────────────────┘

View File

@ -0,0 +1,3 @@
┌─Greeting─────────────────────────────────────────────────────────────────────┐
│ Hello World │
└──────────────────────────────────────────────────────────────────────────────┘

View File

@ -0,0 +1,3 @@
┌─Greeting─────────────────────────────────────────────────────────────────────┐
│ Hello World │
└──────────────────────────────────────────────────────────────────────────────┘

View File

@ -0,0 +1,4 @@
┌─────────────┐
│ Hello World │
│ Foo Bar │
└─────────────┘

View File

@ -0,0 +1,6 @@
┌───────────────────┐
│ │
│ Hello World │
│ │
│ │
└───────────────────┘

View File

@ -0,0 +1,3 @@
┌───────────┐
│Hello World│
└───────────┘

View File

@ -0,0 +1,3 @@
┌─────────────────────────────────────────────────────────────────────Greeting─┐
│ Hello World │
└──────────────────────────────────────────────────────────────────────────────┘

View File

@ -0,0 +1,5 @@
┌────┐
│ │
│ 💩 │
│ │
└────┘

View File

@ -0,0 +1,4 @@
╭─Short paths──────────────────────────────────────────────────────────────────────╮
│ at System.Runtime.CompilerServices.TaskAwaiter. │
│ HandleNonSuccessAndDebuggerNotification(Task task) │
╰──────────────────────────────────────────────────────────────────────────────────╯

View File

@ -1,14 +1,16 @@
using System.Collections.Generic;
using Shouldly;
using System.Threading.Tasks;
using Spectre.Console.Rendering;
using VerifyXunit;
using Xunit;
namespace Spectre.Console.Tests.Unit
{
[UsesVerify]
public sealed class PanelTests
{
[Fact]
public void Should_Render_Panel()
public Task Should_Render_Panel()
{
// Given
var console = new PlainConsole(width: 80);
@ -17,14 +19,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(new Panel(new Text("Hello World")));
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("┌─────────────┐");
console.Lines[1].ShouldBe("│ Hello World │");
console.Lines[2].ShouldBe("└─────────────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Panel_With_Padding_Set_To_Zero()
public Task Should_Render_Panel_With_Padding_Set_To_Zero()
{
// Given
var console = new PlainConsole(width: 80);
@ -36,14 +35,11 @@ namespace Spectre.Console.Tests.Unit
});
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("┌───────────┐");
console.Lines[1].ShouldBe("│Hello World│");
console.Lines[2].ShouldBe("└───────────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Panel_With_Padding()
public Task Should_Render_Panel_With_Padding()
{
// Given
var console = new PlainConsole(width: 80);
@ -55,17 +51,11 @@ namespace Spectre.Console.Tests.Unit
});
// Then
console.Lines.Count.ShouldBe(6);
console.Lines[0].ShouldBe("┌───────────────────┐");
console.Lines[1].ShouldBe("│ │");
console.Lines[2].ShouldBe("│ Hello World │");
console.Lines[3].ShouldBe("│ │");
console.Lines[4].ShouldBe("│ │");
console.Lines[5].ShouldBe("└───────────────────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Panel_With_Header()
public Task Should_Render_Panel_With_Header()
{
// Given
var console = new PlainConsole(width: 80);
@ -79,14 +69,11 @@ namespace Spectre.Console.Tests.Unit
});
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("┌─Greeting─────────────────────────────────────────────────────────────────────┐");
console.Lines[1].ShouldBe("│ Hello World │");
console.Lines[2].ShouldBe("└──────────────────────────────────────────────────────────────────────────────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Panel_With_Left_Aligned_Header()
public Task Should_Render_Panel_With_Left_Aligned_Header()
{
// Given
var console = new PlainConsole(width: 80);
@ -99,14 +86,11 @@ namespace Spectre.Console.Tests.Unit
});
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("┌─Greeting─────────────────────────────────────────────────────────────────────┐");
console.Lines[1].ShouldBe("│ Hello World │");
console.Lines[2].ShouldBe("└──────────────────────────────────────────────────────────────────────────────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Panel_With_Centered_Header()
public Task Should_Render_Panel_With_Centered_Header()
{
// Given
var console = new PlainConsole(width: 80);
@ -119,14 +103,11 @@ namespace Spectre.Console.Tests.Unit
});
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("┌───────────────────────────────────Greeting───────────────────────────────────┐");
console.Lines[1].ShouldBe("│ Hello World │");
console.Lines[2].ShouldBe("└──────────────────────────────────────────────────────────────────────────────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Panel_With_Right_Aligned_Header()
public Task Should_Render_Panel_With_Right_Aligned_Header()
{
// Given
var console = new PlainConsole(width: 80);
@ -139,14 +120,11 @@ namespace Spectre.Console.Tests.Unit
});
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("┌─────────────────────────────────────────────────────────────────────Greeting─┐");
console.Lines[1].ShouldBe("│ Hello World │");
console.Lines[2].ShouldBe("└──────────────────────────────────────────────────────────────────────────────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Collapse_Header_If_It_Will_Not_Fit()
public Task Should_Collapse_Header_If_It_Will_Not_Fit()
{
// Given
var console = new PlainConsole(width: 10);
@ -159,15 +137,11 @@ namespace Spectre.Console.Tests.Unit
});
// Then
console.Lines.Count.ShouldBe(4);
console.Lines[0].ShouldBe("┌─Greet…─┐");
console.Lines[1].ShouldBe("│ Hello │");
console.Lines[2].ShouldBe("│ World │");
console.Lines[3].ShouldBe("└────────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Panel_With_Unicode_Correctly()
public Task Should_Render_Panel_With_Unicode_Correctly()
{
// Given
var console = new PlainConsole(width: 80);
@ -176,16 +150,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(new Panel(new Text(" \n💩\n ")));
// Then
console.Lines.Count.ShouldBe(5);
console.Lines[0].ShouldBe("┌────┐");
console.Lines[1].ShouldBe("│ │");
console.Lines[2].ShouldBe("│ 💩 │");
console.Lines[3].ShouldBe("│ │");
console.Lines[4].ShouldBe("└────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Panel_With_Multiple_Lines()
public Task Should_Render_Panel_With_Multiple_Lines()
{
// Given
var console = new PlainConsole(width: 80);
@ -194,15 +163,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(new Panel(new Text("Hello World\nFoo Bar")));
// Then
console.Lines.Count.ShouldBe(4);
console.Lines[0].ShouldBe("┌─────────────┐");
console.Lines[1].ShouldBe("│ Hello World │");
console.Lines[2].ShouldBe("│ Foo Bar │");
console.Lines[3].ShouldBe("└─────────────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Preserve_Explicit_Line_Ending()
public Task Should_Preserve_Explicit_Line_Ending()
{
// Given
var console = new PlainConsole(width: 80);
@ -213,18 +178,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(text);
// Then
console.Lines.Count.ShouldBe(7);
console.Lines[0].ShouldBe("┌───────────────────────┐");
console.Lines[1].ShouldBe("│ I heard you like 📦 │");
console.Lines[2].ShouldBe("│ │");
console.Lines[3].ShouldBe("│ │");
console.Lines[4].ShouldBe("│ │");
console.Lines[5].ShouldBe("│ So I put a 📦 in a 📦 │");
console.Lines[6].ShouldBe("└───────────────────────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Expand_Panel_If_Enabled()
public Task Should_Expand_Panel_If_Enabled()
{
// Given
var console = new PlainConsole(width: 80);
@ -236,15 +194,11 @@ namespace Spectre.Console.Tests.Unit
});
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].Length.ShouldBe(80);
console.Lines[0].ShouldBe("┌──────────────────────────────────────────────────────────────────────────────┐");
console.Lines[1].ShouldBe("│ Hello World │");
console.Lines[2].ShouldBe("└──────────────────────────────────────────────────────────────────────────────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Justify_Child_To_Right_Correctly()
public Task Should_Justify_Child_To_Right_Correctly()
{
// Given
var console = new PlainConsole(width: 25);
@ -257,14 +211,11 @@ namespace Spectre.Console.Tests.Unit
});
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("┌───────────────────────┐");
console.Lines[1].ShouldBe("│ Hello World │");
console.Lines[2].ShouldBe("└───────────────────────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Center_Child_Correctly()
public Task Should_Center_Child_Correctly()
{
// Given
var console = new PlainConsole(width: 25);
@ -277,14 +228,11 @@ namespace Spectre.Console.Tests.Unit
});
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("┌───────────────────────┐");
console.Lines[1].ShouldBe("│ Hello World │");
console.Lines[2].ShouldBe("└───────────────────────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Panel_Inside_Panel_Correctly()
public Task Should_Render_Panel_Inside_Panel_Correctly()
{
// Given
var console = new PlainConsole(width: 80);
@ -293,16 +241,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(new Panel(new Panel(new Text("Hello World"))));
// Then
console.Lines.Count.ShouldBe(5);
console.Lines[0].ShouldBe("┌─────────────────┐");
console.Lines[1].ShouldBe("│ ┌─────────────┐ │");
console.Lines[2].ShouldBe("│ │ Hello World │ │");
console.Lines[3].ShouldBe("│ └─────────────┘ │");
console.Lines[4].ShouldBe("└─────────────────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Wrap_Content_Correctly()
public Task Should_Wrap_Content_Correctly()
{
// Given
var console = new PlainConsole(width: 84);
@ -322,11 +265,7 @@ namespace Spectre.Console.Tests.Unit
console.Render(panel);
// Then
console.Lines.Count.ShouldBe(4);
console.Lines[0].ShouldBe("╭─Short paths──────────────────────────────────────────────────────────────────────╮");
console.Lines[1].ShouldBe("│ at System.Runtime.CompilerServices.TaskAwaiter. │");
console.Lines[2].ShouldBe("│ HandleNonSuccessAndDebuggerNotification(Task task) │");
console.Lines[3].ShouldBe("╰──────────────────────────────────────────────────────────────────────────────────╯");
return Verifier.Verify(console.Output);
}
}
}

View File

@ -0,0 +1 @@
Favorite fruit? [Banana/Orange] (Banana): Orange

View File

@ -0,0 +1 @@
Favorite fruit? [Banana/Orange] (Banana): Banana

View File

@ -0,0 +1,3 @@
Favorite fruit? [Banana/Orange] (Banana): Apple
Please select one of the available options
Favorite fruit? [Banana/Orange] (Banana): Banana

View File

@ -0,0 +1,7 @@
Guess number: 22
Too low
Guess number: 102
Too high
Guess number: ABC
Invalid input
Guess number: 99

View File

@ -0,0 +1,5 @@
[
Age? ninety-nine,
Invalid input,
Age? 99
]

View File

@ -1,13 +1,15 @@
using System;
using Shouldly;
using System.Threading.Tasks;
using VerifyXunit;
using Xunit;
namespace Spectre.Console.Tests.Unit
{
[UsesVerify]
public sealed class PromptTests
{
[Fact]
public void Should_Return_Validation_Error_If_Value_Cannot_Be_Converted()
public Task Should_Return_Validation_Error_If_Value_Cannot_Be_Converted()
{
// Given
var console = new PlainConsole();
@ -18,14 +20,11 @@ namespace Spectre.Console.Tests.Unit
console.Prompt(new TextPrompt<int>("Age?"));
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("Age? ninety-nine");
console.Lines[1].ShouldBe("Invalid input");
console.Lines[2].ShouldBe("Age? 99");
return Verifier.Verify(console.Lines);
}
[Fact]
public void Should_Chose_Default_Value_If_Nothing_Is_Entered()
public Task Should_Chose_Default_Value_If_Nothing_Is_Entered()
{
// Given
var console = new PlainConsole();
@ -39,12 +38,11 @@ namespace Spectre.Console.Tests.Unit
.DefaultValue("Banana"));
// Then
console.Lines.Count.ShouldBe(1);
console.Lines[0].ShouldBe("Favorite fruit? [Banana/Orange] (Banana): Banana");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Return_Error_If_An_Invalid_Choice_Is_Made()
public Task Should_Return_Error_If_An_Invalid_Choice_Is_Made()
{
// Given
var console = new PlainConsole();
@ -59,14 +57,11 @@ namespace Spectre.Console.Tests.Unit
.DefaultValue("Banana"));
// Then
console.Lines.Count.ShouldBe(3);
console.Lines[0].ShouldBe("Favorite fruit? [Banana/Orange] (Banana): Apple");
console.Lines[1].ShouldBe("Please select one of the available options");
console.Lines[2].ShouldBe("Favorite fruit? [Banana/Orange] (Banana): Banana");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Accept_Choice_In_List()
public Task Should_Accept_Choice_In_List()
{
// Given
var console = new PlainConsole();
@ -80,12 +75,11 @@ namespace Spectre.Console.Tests.Unit
.DefaultValue("Banana"));
// Then
console.Lines.Count.ShouldBe(1);
console.Lines[0].ShouldBe("Favorite fruit? [Banana/Orange] (Banana): Orange");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Return_Error_If_Custom_Validation_Fails()
public Task Should_Return_Error_If_Custom_Validation_Fails()
{
// Given
var console = new PlainConsole();
@ -113,14 +107,7 @@ namespace Spectre.Console.Tests.Unit
}));
// Then
console.Lines.Count.ShouldBe(7);
console.Lines[0].ShouldBe("Guess number: 22");
console.Lines[1].ShouldBe("Too low");
console.Lines[2].ShouldBe("Guess number: 102");
console.Lines[3].ShouldBe("Too high");
console.Lines[4].ShouldBe("Guess number: ABC");
console.Lines[5].ShouldBe("Invalid input");
console.Lines[6].ShouldBe("Guess number: 99");
return Verifier.Verify(console.Output);
}
}
}

View File

@ -0,0 +1,10 @@
<pre style="font-size:90%;font-family:consolas,'Courier New',monospace">
<span>┌─────────────────┬───────┬─────┐</span>
<span>│ </span><span style="color: #FF0000;background-color: #000000">Foo</span><span> │ </span><span style="color: #008000;font-weight: bold;font-style: italic">Bar</span><span> │ </span><span style="color: #0000FF">Qux</span><span> │</span>
<span>├─────────────────┼───────┼─────┤</span>
<span>│ </span><span style="text-decoration: underline">Corgi</span><span> │ </span><span style="font-weight: bold;font-style: italic;text-decoration: line-through">Waldo</span><span> │ </span><span style="color: #7F7F7F">Zap</span><span> │</span>
<span>│ </span><span style="color: #FF0000">╭─────────────╮</span><span> │ │ │</span>
<span>│ </span><span style="color: #FF0000">│</span><span> </span><span style="color: #0000FF">Hello World</span><span> </span><span style="color: #FF0000">│</span><span> │ │ │</span>
<span>│ </span><span style="color: #FF0000">╰─────────────╯</span><span> │ │ │</span>
<span>└─────────────────┴───────┴─────┘</span>
</pre>

View File

@ -0,0 +1,8 @@
┌─────────────────┬───────┬─────┐
│ Foo │ Bar │ Qux │
├─────────────────┼───────┼─────┤
│ Corgi │ Waldo │ Zap │
│ ╭─────────────╮ │ │ │
│ │ Hello World │ │ │ │
│ ╰─────────────╯ │ │ │
└─────────────────┴───────┴─────┘

View File

@ -1,12 +1,14 @@
using Shouldly;
using System.Threading.Tasks;
using VerifyXunit;
using Xunit;
namespace Spectre.Console.Tests.Unit
{
[UsesVerify]
public sealed class RecorderTests
{
[Fact]
public void Should_Export_Text_As_Expected()
public Task Should_Export_Text_As_Expected()
{
// Given
var console = new PlainConsole();
@ -18,22 +20,14 @@ namespace Spectre.Console.Tests.Unit
.AddRow(new Panel("Hello World").RoundedBorder()));
// When
var result = recorder.ExportText().Split(new[] { '\n' });
var result = recorder.ExportText();
// Then
result.Length.ShouldBe(8);
result[0].ShouldBe("┌─────────────────┬───────┬─────┐");
result[1].ShouldBe("│ Foo │ Bar │ Qux │");
result[2].ShouldBe("├─────────────────┼───────┼─────┤");
result[3].ShouldBe("│ Corgi │ Waldo │ Zap │");
result[4].ShouldBe("│ ╭─────────────╮ │ │ │");
result[5].ShouldBe("│ │ Hello World │ │ │ │");
result[6].ShouldBe("│ ╰─────────────╯ │ │ │");
result[7].ShouldBe("└─────────────────┴───────┴─────┘");
return Verifier.Verify(result);
}
[Fact]
public void Should_Export_Html_As_Expected()
public Task Should_Export_Html_As_Expected()
{
// Given
var console = new PlainConsole();
@ -46,21 +40,10 @@ namespace Spectre.Console.Tests.Unit
.BorderColor(Color.Red).RoundedBorder()));
// When
var html = recorder.ExportHtml();
var result = html.Split(new[] { '\n' });
var result = recorder.ExportHtml();
// Then
result.Length.ShouldBe(10);
result[0].ShouldBe("<pre style=\"font-size:90%;font-family:consolas,'Courier New',monospace\">");
result[1].ShouldBe("<span>┌─────────────────┬───────┬─────┐</span>");
result[2].ShouldBe("<span>│ </span><span style=\"color: #FF0000;background-color: #000000\">Foo</span><span> │ </span><span style=\"color: #008000;font-weight: bold;font-style: italic\">Bar</span><span> │ </span><span style=\"color: #0000FF\">Qux</span><span> │</span>");
result[3].ShouldBe("<span>├─────────────────┼───────┼─────┤</span>");
result[4].ShouldBe("<span>│ </span><span style=\"text-decoration: underline\">Corgi</span><span> │ </span><span style=\"font-weight: bold;font-style: italic;text-decoration: line-through\">Waldo</span><span> │ </span><span style=\"color: #7F7F7F\">Zap</span><span> │</span>");
result[5].ShouldBe("<span>│ </span><span style=\"color: #FF0000\">╭─────────────╮</span><span> │ │ │</span>");
result[6].ShouldBe("<span>│ </span><span style=\"color: #FF0000\">│</span><span> </span><span style=\"color: #0000FF\">Hello World</span><span> </span><span style=\"color: #FF0000\">│</span><span> │ │ │</span>");
result[7].ShouldBe("<span>│ </span><span style=\"color: #FF0000\">╰─────────────╯</span><span> │ │ │</span>");
result[8].ShouldBe("<span>└─────────────────┴───────┴─────┘</span>");
result[9].ShouldBe("</pre>");
return Verifier.Verify(result);
}
}
}

View File

@ -0,0 +1,7 @@
Hello
┌─────┬─────┐
│ Foo │ Bar │
├─────┼─────┤
│ Baz │ Qux │
└─────┴─────┘
World

View File

@ -0,0 +1,7 @@
┌─────────────┬─────┐
│ Foo │ Bar │
├─────────────┼─────┤
│ HELLO WORLD │ │
│ Hello │ Qux │
│ World │ │
└─────────────┴─────┘

View File

@ -0,0 +1,7 @@
┌────────────────────────────────────────────────────┬─────┐
│ Foo │ Bar │
├────────────────────────────────────────────────────┼─────┤
│ HELLO WORLD │ │
│ Hello │ Qux │
│ World │ │
└────────────────────────────────────────────────────┴─────┘

View File

@ -1,13 +1,15 @@
using Shouldly;
using System.Threading.Tasks;
using Spectre.Console.Rendering;
using VerifyXunit;
using Xunit;
namespace Spectre.Console.Tests.Unit
{
[UsesVerify]
public sealed class RowsTests
{
[Fact]
public void Should_Render_Rows()
public Task Should_Render_Rows()
{
// Given
var console = new PlainConsole(width: 60);
@ -25,18 +27,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(rows);
// Then
console.Lines.Count.ShouldBe(7);
console.Lines[0].ShouldBe("Hello");
console.Lines[1].ShouldBe("┌─────┬─────┐");
console.Lines[2].ShouldBe("│ Foo │ Bar │");
console.Lines[3].ShouldBe("├─────┼─────┤");
console.Lines[4].ShouldBe("│ Baz │ Qux │");
console.Lines[5].ShouldBe("└─────┴─────┘");
console.Lines[6].ShouldBe("World");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Rows_Correctly_Inside_Other_Widget()
public Task Should_Render_Rows_Correctly_Inside_Other_Widget()
{
// Given
var console = new PlainConsole(width: 60);
@ -54,18 +49,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(table);
// Then
console.Lines.Count.ShouldBe(7);
console.Lines[0].ShouldBe("┌─────────────┬─────┐");
console.Lines[1].ShouldBe("│ Foo │ Bar │");
console.Lines[2].ShouldBe("├─────────────┼─────┤");
console.Lines[3].ShouldBe("│ HELLO WORLD │ │");
console.Lines[4].ShouldBe("│ Hello │ Qux │");
console.Lines[5].ShouldBe("│ World │ │");
console.Lines[6].ShouldBe("└─────────────┴─────┘");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Rows_Correctly_Inside_Other_Widget_When_Expanded()
public Task Should_Render_Rows_Correctly_Inside_Other_Widget_When_Expanded()
{
// Given
var console = new PlainConsole(width: 60);
@ -83,14 +71,7 @@ namespace Spectre.Console.Tests.Unit
console.Render(table);
// Then
console.Lines.Count.ShouldBe(7);
console.Lines[0].ShouldBe("┌────────────────────────────────────────────────────┬─────┐");
console.Lines[1].ShouldBe("│ Foo │ Bar │");
console.Lines[2].ShouldBe("├────────────────────────────────────────────────────┼─────┤");
console.Lines[3].ShouldBe("│ HELLO WORLD │ │");
console.Lines[4].ShouldBe("│ Hello │ Qux │");
console.Lines[5].ShouldBe("│ World │ │");
console.Lines[6].ShouldBe("└────────────────────────────────────────────────────┴─────┘");
return Verifier.Verify(console.Output);
}
}
}

View File

@ -0,0 +1 @@
──────────── Hello World ! ─────────────

View File

@ -0,0 +1 @@
════════════════════════════════════════

View File

@ -0,0 +1 @@
───────────── Hello World ──────────────

View File

@ -0,0 +1 @@
── Hello World ─────────────────────────

View File

@ -0,0 +1 @@
───────────────────────── Hello World ──

View File

@ -0,0 +1 @@
────────────────────────────────────────

View File

@ -0,0 +1 @@
═════════════ Hello World ══════════════

View File

@ -0,0 +1 @@
───────────── Hello World ──────────────

View File

@ -1,12 +1,15 @@
using System.Threading.Tasks;
using Shouldly;
using VerifyXunit;
using Xunit;
namespace Spectre.Console.Tests.Unit
{
[UsesVerify]
public sealed class RuleTests
{
[Fact]
public void Should_Render_Default_Rule_Without_Title()
public Task Should_Render_Default_Rule_Without_Title()
{
// Given
var console = new PlainConsole(width: 40);
@ -15,12 +18,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(new Rule());
// Then
console.Lines.Count.ShouldBe(1);
console.Lines[0].ShouldBe("────────────────────────────────────────");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Default_Rule_With_Specified_Box()
public Task Should_Render_Default_Rule_With_Specified_Box()
{
// Given
var console = new PlainConsole(width: 40);
@ -29,12 +31,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(new Rule().DoubleBorder());
// Then
console.Lines.Count.ShouldBe(1);
console.Lines[0].ShouldBe("════════════════════════════════════════");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_With_Specified_Box()
public Task Should_Render_With_Specified_Box()
{
// Given
var console = new PlainConsole(width: 40);
@ -43,12 +44,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(new Rule("Hello World").DoubleBorder());
// Then
console.Lines.Count.ShouldBe(1);
console.Lines[0].ShouldBe("═════════════ Hello World ══════════════");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Default_Rule_With_Title_Centered_By_Default()
public Task Should_Render_Default_Rule_With_Title_Centered_By_Default()
{
// Given
var console = new PlainConsole(width: 40);
@ -57,12 +57,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(new Rule("Hello World"));
// Then
console.Lines.Count.ShouldBe(1);
console.Lines[0].ShouldBe("───────────── Hello World ──────────────");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Default_Rule_With_Title_Left_Aligned()
public Task Should_Render_Default_Rule_With_Title_Left_Aligned()
{
// Given
var console = new PlainConsole(width: 40);
@ -74,12 +73,11 @@ namespace Spectre.Console.Tests.Unit
});
// Then
console.Lines.Count.ShouldBe(1);
console.Lines[0].ShouldBe("── Hello World ─────────────────────────");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Render_Default_Rule_With_Title_Right_Aligned()
public Task Should_Render_Default_Rule_With_Title_Right_Aligned()
{
// Given
var console = new PlainConsole(width: 40);
@ -91,12 +89,11 @@ namespace Spectre.Console.Tests.Unit
});
// Then
console.Lines.Count.ShouldBe(1);
console.Lines[0].ShouldBe("───────────────────────── Hello World ──");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Convert_Line_Breaks_In_Title_To_Spaces()
public Task Should_Convert_Line_Breaks_In_Title_To_Spaces()
{
// Given
var console = new PlainConsole(width: 40);
@ -105,12 +102,11 @@ namespace Spectre.Console.Tests.Unit
console.Render(new Rule("Hello\nWorld\r\n!"));
// Then
console.Lines.Count.ShouldBe(1);
console.Lines[0].ShouldBe("──────────── Hello World ! ─────────────");
return Verifier.Verify(console.Output);
}
[Fact]
public void Should_Truncate_Title()
public Task Should_Truncate_Title()
{
// Given
var console = new PlainConsole(width: 40);
@ -119,8 +115,7 @@ namespace Spectre.Console.Tests.Unit
console.Render(new Rule(" Hello World "));
// Then
console.Lines.Count.ShouldBe(1);
console.Lines[0].ShouldBe("───────────── Hello World ──────────────");
return Verifier.Verify(console.Output);
}
[Theory]

View File

@ -0,0 +1,43 @@
[
[
{
Text: Foo,
Style: {
Foreground: {},
Background: {}
}
},
{
Text: Bar,
Style: {
Foreground: {},
Background: {}
}
}
],
[
{
Text: Baz,
Style: {
Foreground: {},
Background: {}
}
},
{
Text: Qux,
Style: {
Foreground: {},
Background: {}
}
}
],
[
{
Text: Corgi,
Style: {
Foreground: {},
Background: {}
}
}
]
]

View File

@ -0,0 +1,45 @@
[
[
{
Text: Foo,
Style: {
Foreground: {},
Background: {}
}
}
],
[
{
Text: Bar,
Style: {
Foreground: {},
Background: {}
}
}
],
[
{
Text: Baz,
Style: {
Foreground: {},
Background: {}
}
},
{
Text: Qux,
Style: {
Foreground: {},
Background: {}
}
}
],
[
{
Text: Corgi,
Style: {
Foreground: {},
Background: {}
}
}
]
]

View File

@ -0,0 +1,26 @@
{
Item1: {
Text: Foo,
Style: {
Foreground: {
R: 255
},
Background: {
G: 128
},
Decoration: Bold
}
},
Item2: {
Text: Bar,
Style: {
Foreground: {
R: 255
},
Background: {
G: 128
},
Decoration: Bold
}
}
}

View File

@ -1,6 +1,8 @@
using System.Text;
using System.Threading.Tasks;
using Shouldly;
using Spectre.Console.Rendering;
using VerifyXunit;
using Xunit;
namespace Spectre.Console.Tests.Unit
@ -17,30 +19,29 @@ namespace Spectre.Console.Tests.Unit
result.ShouldBe(4);
}
[UsesVerify]
public sealed class TheSplitMethod
{
[Fact]
public void Should_Split_Segment_Correctly()
public Task Should_Split_Segment_Correctly()
{
// Given
var style = new Style(Color.Red, Color.Green, Decoration.Bold);
var segment = new Segment("Foo Bar", style);
// When
var (first, second) = segment.Split(3);
var result = segment.Split(3);
// Then
first.Text.ShouldBe("Foo");
first.Style.ShouldBe(style);
second.Text.ShouldBe(" Bar");
second.Style.ShouldBe(style);
return Verifier.Verify(result);
}
}
[UsesVerify]
public sealed class TheSplitLinesMethod
{
[Fact]
public void Should_Split_Segment()
public Task Should_Split_Segment()
{
var context = new RenderContext(Encoding.UTF8, false);
@ -70,10 +71,11 @@ namespace Spectre.Console.Tests.Unit
lines[2].Count.ShouldBe(1);
lines[2][0].Text.ShouldBe("Corgi");
return Verifier.Verify(lines);
}
[Fact]
public void Should_Split_Segments_With_Linebreak_In_Text()
public Task Should_Split_Segments_With_Linebreak_In_Text()
{
var context = new RenderContext(Encoding.UTF8, false);
var lines = Segment.SplitLines(
@ -88,20 +90,7 @@ namespace Spectre.Console.Tests.Unit
});
// Then
lines.Count.ShouldBe(4);
lines[0].Count.ShouldBe(1);
lines[0][0].Text.ShouldBe("Foo");
lines[1].Count.ShouldBe(1);
lines[1][0].Text.ShouldBe("Bar");
lines[2].Count.ShouldBe(2);
lines[2][0].Text.ShouldBe("Baz");
lines[2][1].Text.ShouldBe("Qux");
lines[3].Count.ShouldBe(1);
lines[3][0].Text.ShouldBe("Corgi");
return Verifier.Verify(lines);
}
}
}

View File

@ -0,0 +1,8 @@
+----------+----------+
| Header 1 | Header 2 |
|----------+----------|
| Cell | Cell |
| Cell | Cell |
|----------+----------|
| Footer 1 | Footer 2 |
+----------+----------+

View File

@ -0,0 +1,8 @@
+---------------------+
| Header 1 | Header 2 |
|----------+----------|
| Cell | Cell |
| Cell | Cell |
|----------+----------|
| Footer 1 | Footer 2 |
+---------------------+

View File

@ -0,0 +1,8 @@
+----------+----------+
| Header 1 | Header 2 |
|==========+==========|
| Cell | Cell |
| Cell | Cell |
+----------+----------+
| Footer 1 | Footer 2 |
+----------+----------+

View File

@ -0,0 +1,8 @@
╔══════════╦══════════╗
║ Header 1 ║ Header 2 ║
╠══════════╬══════════╣
║ Cell ║ Cell ║
║ Cell ║ Cell ║
╠══════════╬══════════╣
║ Footer 1 ║ Footer 2 ║
╚══════════╩══════════╝

View File

@ -0,0 +1,8 @@
╔══════════╤══════════╗
║ Header 1 │ Header 2 ║
╟──────────┼──────────╢
║ Cell │ Cell ║
║ Cell │ Cell ║
╟──────────┼──────────╢
║ Footer 1 │ Footer 2 ║
╚══════════╧══════════╝

View File

@ -0,0 +1,8 @@
┏━━━━━━━━━━┳━━━━━━━━━━┓
┃ Header 1 ┃ Header 2 ┃
┣━━━━━━━━━━╋━━━━━━━━━━┫
┃ Cell ┃ Cell ┃
┃ Cell ┃ Cell ┃
┣━━━━━━━━━━╋━━━━━━━━━━┫
┃ Footer 1 ┃ Footer 2 ┃
┗━━━━━━━━━━┻━━━━━━━━━━┛

View File

@ -0,0 +1,8 @@
┏━━━━━━━━━━┯━━━━━━━━━━┓
┃ Header 1 │ Header 2 ┃
┠──────────┼──────────┨
┃ Cell │ Cell ┃
┃ Cell │ Cell ┃
┠──────────┼──────────┨
┃ Footer 1 │ Footer 2 ┃
┗━━━━━━━━━━┷━━━━━━━━━━┛

View File

@ -0,0 +1,8 @@
┏━━━━━━━━━━┳━━━━━━━━━━┓
┃ Header 1 ┃ Header 2 ┃
┡━━━━━━━━━━╇━━━━━━━━━━┩
│ Cell │ Cell │
│ Cell │ Cell │
├──────────┼──────────┤
│ Footer 1 │ Footer 2 │
└──────────┴──────────┘

View File

@ -0,0 +1,8 @@
───────────────────────
Header 1 Header 2
───────────────────────
Cell Cell
Cell Cell
───────────────────────
Footer 1 Footer 2
───────────────────────

View File

@ -0,0 +1,7 @@
| Header 1 | Header 2 |
| -------- | -------- |
| Cell | Cell |
| Cell | Cell |
| Footer 1 | Footer 2 |

View File

@ -0,0 +1,7 @@
| Header 1 | Header 2 |
| -------- | :------: |
| Cell | Cell |
| Cell | Cell |
| Footer 1 | Footer 2 |

View File

@ -0,0 +1,7 @@
| Header 1 | Header 2 |
| -------- | :------- |
| Cell | Cell |
| Cell | Cell |
| Footer 1 | Footer 2 |

View File

@ -0,0 +1,7 @@
| Header 1 | Header 2 |
| -------- | -------: |
| Cell | Cell |
| Cell | Cell |
| Footer 1 | Footer 2 |

View File

@ -0,0 +1,8 @@
Header 1 │ Header 2
──────────┼──────────
Cell │ Cell
Cell │ Cell
──────────┼──────────
Footer 1 │ Footer 2

View File

@ -0,0 +1,8 @@
Header 1 │ Header 2
══════════╪══════════
Cell │ Cell
Cell │ Cell
══════════╪══════════
Footer 1 │ Footer 2

View File

@ -0,0 +1,8 @@
Header 1 │ Header 2
━━━━━━━━━━┿━━━━━━━━━━
Cell │ Cell
Cell │ Cell
━━━━━━━━━━┿━━━━━━━━━━
Footer 1 │ Footer 2

View File

@ -0,0 +1,4 @@
Header 1 Header 2
Cell Cell
Cell Cell
Footer 1 Footer 2

View File

@ -0,0 +1,8 @@
╭──────────┬──────────╮
│ Header 1 │ Header 2 │
├──────────┼──────────┤
│ Cell │ Cell │
│ Cell │ Cell │
├──────────┼──────────┤
│ Footer 1 │ Footer 2 │
╰──────────┴──────────╯

View File

@ -0,0 +1,8 @@
Header 1 Header 2
───────────────────────
Cell Cell
Cell Cell
───────────────────────
Footer 1 Footer 2

View File

@ -0,0 +1,8 @@
Header 1 Header 2
━━━━━━━━━━━━━━━━━━━━━━━
Cell Cell
Cell Cell
━━━━━━━━━━━━━━━━━━━━━━━
Footer 1 Footer 2

View File

@ -0,0 +1,8 @@
┌──────────┬──────────┐
│ Header 1 │ Header 2 │
├──────────┼──────────┤
│ Cell │ Cell │
│ Cell │ Cell │
├──────────┼──────────┤
│ Footer 1 │ Footer 2 │
└──────────┴──────────┘

Some files were not shown because too many files have changed in this diff Show More