Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Test Naming #939

Merged
merged 3 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/Silk.NET.SilkTouch.Emitter.Tests/EmitterFieldTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void FieldIsPublic()
}

[Fact]
public void FieldHasCorrectTypeIdentifier()
public void CorrectTypeIdentifier()
{
var syntax = Transform
(
Expand All @@ -57,7 +57,7 @@ public void FieldHasCorrectTypeIdentifier()
}

[Fact]
public void FieldHasCorrectIdentifier()
public void CorrectIdentifier()
{
var syntax = Transform
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Silk.NET.SilkTouch.Emitter.Tests;
public class EmitterNamespaceMemberTests : EmitterTest
{
[Fact]
public void NamespaceIntegration()
public void SingleMemberIntegration()
{
var syntax = Transform(new NamespaceSymbol(new IdentifierSymbol("Test"), (new []
{
Expand All @@ -21,4 +21,17 @@ public void NamespaceIntegration()
var result = syntax.ToFullString();
Assert.Equal("namespace Test\n{\n[StructLayout(LayoutKind.Explicit)]\npublic struct Test2\n{\n}\n}\n", result);
}

[Fact]
public void MultipleMembersIntegration()
{
var syntax = Transform(new NamespaceSymbol(new IdentifierSymbol("Test"), (new []
{
(TypeSymbol)new StructSymbol(new IdentifierSymbol("Test2"), StructLayout.Empty),
(TypeSymbol)new StructSymbol(new IdentifierSymbol("Test3"), StructLayout.Empty)
}).ToImmutableArray()));

var result = syntax.ToFullString();
Assert.Equal("namespace Test\n{\n[StructLayout(LayoutKind.Explicit)]\npublic struct Test2\n{\n}\n[StructLayout(LayoutKind.Explicit)]\npublic struct Test3\n{\n}\n}\n", result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void NamespaceIntegration()
}

[Fact]
public void NamespaceHasCorrectIdentifier()
public void CorrectIdentifier()
{
var syntax = Transform
(new NamespaceSymbol(new IdentifierSymbol("Test"), ImmutableArray<TypeSymbol>.Empty)) as
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Silk.NET.SilkTouch.Emitter.Tests;
public class EmitterStructMemberFieldsTests : EmitterTest
{
[Fact]
public void StructWithSingleFieldIntegration()
public void SingleFieldIntegration()
{
var node = Transform
(
Expand Down Expand Up @@ -40,7 +40,7 @@ public struct Test
}

[Fact]
public void StructWithMultipleFieldsIntegration()
public void MultipleFieldsIntegration()
{
var node = Transform
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@ namespace Silk.NET.SilkTouch.Emitter.Tests;
public sealed class EmitterStructTests : EmitterTest
{
[Fact]
public void StructIsStructSyntax()
public void StructSyntax()
{
var syntax = Transform(new StructSymbol(new IdentifierSymbol("Test"), StructLayout.Empty));
Assert.IsType<StructDeclarationSyntax>(syntax);
}

[Fact]
public void StructHasStructKeyword()
public void StructKeyword()
{
var syntax = Transform(new StructSymbol(new IdentifierSymbol("Test"), StructLayout.Empty)) as StructDeclarationSyntax;
Assert.Equal("struct", syntax!.Keyword.Text);
}

[Fact]
public void StructHasCorrectIdentifier()
public void CorrectIdentifier()
{
var syntax = Transform(new StructSymbol(new IdentifierSymbol("Test"), StructLayout.Empty)) as StructDeclarationSyntax;
Assert.Equal("Test", syntax!.Identifier.Text);
}

[Fact]
public void StructIsOnlyPublic()
public void IsOnlyPublic()
{
var syntax = Transform(new StructSymbol(new IdentifierSymbol("Test"), StructLayout.Empty)) as StructDeclarationSyntax;
var @public = Assert.Single(syntax!.Modifiers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class StructIntegrationTests
[Fact]
public Task Test1()
{
var result = TestHelper.GetCSharpOutputFromCPP(@"
var result = TestHelper.GetCSharpOutputFromCpp(@"
#include <stdint.h>

typedef struct {
Expand Down
2 changes: 1 addition & 1 deletion tests/Silk.NET.SilkTouch.IntegrationTests/TestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Silk.NET.SilkTouch.IntegrationTests;

public static class TestHelper
{
public static string GetCSharpOutputFromCPP(string cpp)
public static string GetCSharpOutputFromCpp(string cpp)
{
var tempFile = Path.GetTempFileName();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Silk.NET.SilkTouch.Scraper.Tests;
public class IdentityScrapingTests
{
[Fact]
public void EmptyXmlGeneratesNoSymbols()
public void GeneratesNoSymbols()
{
var doc = new XmlDocument();

Expand All @@ -20,7 +20,7 @@ public void EmptyXmlGeneratesNoSymbols()
}

[Fact]
public void EmptyBindingsXmlGeneratesNoSymbols()
public void BindingsGeneratesNoSymbols()
{
var doc = new XmlDocument();
doc.LoadXml(@"<bindings>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Silk.NET.SilkTouch.Scraper.Tests;
public class StructScrapingTests
{
[Fact]
public void StructXMLGeneratesStructSymbol()
public void StructSymbol()
{
var doc = new XmlDocument();
doc.LoadXml(@"<struct name=""Test""></struct>");
Expand All @@ -22,7 +22,7 @@ public void StructXMLGeneratesStructSymbol()
}

[Fact]
public void StructXMLGeneratesCorrectIdentifier()
public void CorrectIdentifier()
{
var doc = new XmlDocument();
doc.LoadXml(@"<struct name=""Test""></struct>");
Expand Down