-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rebranding
- Loading branch information
Showing
18 changed files
with
137 additions
and
78 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
File renamed without changes.
19 changes: 19 additions & 0 deletions
19
benchmarks/CodeOwners.Benchmarks/CodeOwners.Benchmarks.csproj
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,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="BenchmarkDotNet" Version="0.13.1"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\CodeOwners\CodeOwners.csproj"/> | ||
</ItemGroup> | ||
|
||
</Project> |
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
2 changes: 1 addition & 1 deletion
2
...ks/CodeOwnersParser.Benchmarks/Program.cs → benchmarks/CodeOwners.Benchmarks/Program.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using BenchmarkDotNet.Running; | ||
using CodeOwners.Benchmarks; | ||
|
||
BenchmarkRunner.Run<CodeOwnersParserBenchmark>(); | ||
BenchmarkRunner.Run<CodeOwnersSerializerBenchmark>(); |
20 changes: 0 additions & 20 deletions
20
benchmarks/CodeOwnersParser.Benchmarks/CodeOwnersParser.Benchmarks.csproj
This file was deleted.
Oops, something went 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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,30 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
|
||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FluentAssertions" Version="6.7.0"/> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0"/> | ||
<PackageReference Include="Snapshooter.Xunit" Version="0.7.1"/> | ||
<PackageReference Include="xunit" Version="2.4.1"/> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="3.1.2"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\CodeOwners\CodeOwners.csproj"/> | ||
</ItemGroup> | ||
|
||
</Project> |
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,11 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using FluentAssertions; | ||
using Snapshooter.Xunit; | ||
using Xunit; | ||
|
||
namespace CodeOwners.Tests; | ||
|
||
public class CodeOwnersParserTests | ||
public class CodeOwnersSerializerTests | ||
{ | ||
public static IEnumerable<object[]> CorrectData | ||
{ | ||
|
@@ -66,17 +67,18 @@ public static IEnumerable<object[]> CorrectData | |
|
||
[Theory] | ||
[MemberData(nameof(CorrectData))] | ||
public void Parse_ShouldParseContentCorrectly(string content, IEnumerable<CodeOwnersEntry> expectedResult) | ||
public void Deserialize_ShouldDeserializeContentCorrectly(string content, | ||
IEnumerable<CodeOwnersEntry> expectedResult) | ||
{ | ||
// Arrange + Act | ||
var result = CodeOwnersParser.Parse(content); | ||
var result = CodeOwnersSerializer.Deserialize(content); | ||
|
||
// Assert | ||
result.Should().BeEquivalentTo(expectedResult); | ||
} | ||
|
||
[Fact] | ||
public void Parse_ShouldParseMultiLineContentCorrectly() | ||
public void Deserialize_ShouldDeserializeMultiLineContentCorrectly() | ||
{ | ||
// Arrange | ||
var content = @"# This is a comment. | ||
|
@@ -135,7 +137,7 @@ public void Parse_ShouldParseMultiLineContentCorrectly() | |
/apps/github"; | ||
|
||
// Act | ||
var result = CodeOwnersParser.Parse(content); | ||
var result = CodeOwnersSerializer.Deserialize(content); | ||
|
||
// Assert | ||
result.Should().BeEquivalentTo(new List<CodeOwnersEntry> | ||
|
@@ -153,4 +155,38 @@ public void Parse_ShouldParseMultiLineContentCorrectly() | |
new("/apps/github", new List<string>()) | ||
}); | ||
} | ||
|
||
|
||
[Fact] | ||
public void Serialize_ShouldSerializeOneLineContentCorrectly() | ||
{ | ||
// Arrange | ||
var codeOwners = | ||
new List<CodeOwnersEntry> { new("*", new List<string> { "@global-owner1", "@global-owner2" }) }; | ||
|
||
// Act | ||
var result = CodeOwnersSerializer.Serialize(codeOwners); | ||
|
||
// Assert | ||
result.MatchSnapshot(); | ||
} | ||
|
||
[Fact] | ||
public void Serialize_ShouldSerializeMultiLineContentCorrectly() | ||
{ | ||
// Arrange | ||
var codeOwners = | ||
new List<CodeOwnersEntry> | ||
{ | ||
new("*", new List<string> { "@global-owner1", "@global-owner2" }), | ||
new("*.js", new List<string> { "@js-owner" }), | ||
new("*.go", new List<string> { "[email protected]" }), | ||
}; | ||
|
||
// Act | ||
var result = CodeOwnersSerializer.Serialize(codeOwners); | ||
|
||
// Assert | ||
result.MatchSnapshot(); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...shots__/CodeOwnersSerializerTests.Serialize_ShouldSerializeMultiLineContentCorrectly.snap
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,3 @@ | ||
* @global-owner1 @global-owner2 | ||
*.js @js-owner | ||
*.go docs@example.com |
1 change: 1 addition & 0 deletions
1
...apshots__/CodeOwnersSerializerTests.Serialize_ShouldSerializeOneLineContentCorrectly.snap
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 @@ | ||
* @global-owner1 @global-owner2 |
30 changes: 0 additions & 30 deletions
30
tests/CodeOwnersParser.Tests/CodeOwnersParser.Tests.csproj
This file was deleted.
Oops, something went wrong.