Skip to content

Commit

Permalink
Merge pull request #27 from skbkontur/net6
Browse files Browse the repository at this point in the history
tests in net6
  • Loading branch information
fakefeik authored Nov 30, 2021
2 parents 657f5ca + 00dd6af commit 4ba9cb3
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 47 deletions.
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"jetbrains.resharper.globaltools": {
"version": "2021.2.2",
"commands": [
"jb"
]
}
}
}
65 changes: 47 additions & 18 deletions Common.DotSettings

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.4.244" PrivateAssets="All" />
</ItemGroup>

</Project>
12 changes: 6 additions & 6 deletions GroBuf.Tests/GroBuf.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<PropertyGroup>
<IsPackable>false</IsPackable>
<TargetFrameworks>net48;netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>net48;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="protobuf-net" Version="3.0.73" />
<PackageReference Include="FluentAssertions" Version="6.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
<PackageReference Include="protobuf-net" Version="3.0.101" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 7 additions & 7 deletions GroBuf.Tests/TestStrings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Diagnostics;
using System.Text;

Expand Down Expand Up @@ -44,28 +44,28 @@ public void TestPerformance()
[Test]
public void TestString()
{
const string s = "zzz àðîâàðî \u2376 \uDEAD";
const string s = "zzz ароваро \u2376 \uDEAD";
byte[] bytes = serializer.Serialize(s);
var deserialize = serializer.Deserialize<string>(bytes);
Assert.AreEqual("zzz àðîâàðî \u2376 \uDEAD", deserialize);
Assert.AreEqual("zzz ароваро \u2376 \uDEAD", deserialize);
}

[Test]
public void TestString1()
{
const string s = "zzz àðîâàðî \u2376 \uDEAD";
const string s = "zzz ароваро \u2376 \uDEAD";
byte[] bytes = serializer.Serialize(typeof(string), s);
var deserialize = serializer.Deserialize(typeof(string), bytes);
Assert.AreEqual("zzz àðîâàðî \u2376 \uDEAD", deserialize);
Assert.AreEqual("zzz ароваро \u2376 \uDEAD", deserialize);
}

[Test]
public void TestStringInProp()
{
const string s = "zzz àðîâàðî \u2376 \uDEAD";
const string s = "zzz ароваро \u2376 \uDEAD";
byte[] bytes = serializer.Serialize(new WithS {S = s});
var deserialize = serializer.Deserialize<WithS>(bytes);
Assert.AreEqual("zzz àðîâàðî \u2376 \uDEAD", deserialize.S);
Assert.AreEqual("zzz ароваро \u2376 \uDEAD", deserialize.S);
}

[Test]
Expand Down
4 changes: 2 additions & 2 deletions GroBuf.Tests/TestTools/XmlHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using System.Text;
using System.Xml;
Expand All @@ -11,7 +11,7 @@ public static XmlNode GoToChild(this XmlNode node, string name)
{
var xmlNode = TryGoToChild(node, name);
if (xmlNode != null) return xmlNode;
throw new FormatException(string.Format("Ó ýëåìåíòà '{0}' íå íàéäåíî äî÷åðíåãî '{1}'", node.Name, name));
throw new FormatException(string.Format("У элемента '{0}' не найдено дочернего '{1}'", node.Name, name));
}

public static XmlNode TryGoToChild(this XmlNode node, string name)
Expand Down
2 changes: 1 addition & 1 deletion GroBuf/GroBuf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GrEmit" Version="3.4.1" />
<PackageReference Include="GrEmit" Version="3.4.10" />
<PackageReference Include="Mono.Reflection" Version="2.0.0" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions GroBuf/Readers/ReaderMethodBuilderContext.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Reflection;

Expand Down Expand Up @@ -201,7 +201,7 @@ public void SkipValue()
LoadIndexByRef(); // stack: [ref index]
LoadIndex(); // stack: [ref index, index]

// todo: ñäåëàòü switch
// todo: сделать switch
Il.Ldloc(TypeCode); // stack: [ref index, index, TypeCode]
Il.Ldc_I4((int)GroBufTypeCode.DateTimeOld); // stack: [ref index, index, TypeCode, GroBufTypeCode.DateTimeOld]
var notDateTimeLabel = Il.DefineLabel("notDateTime");
Expand Down
26 changes: 18 additions & 8 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,46 @@ skip_commits:
files:
- '**/*.md'

image: Visual Studio 2019
image: Visual Studio 2022

init:
- cmd: git config --global core.autocrlf false

nuget:
disable_publish_on_pr: true

before_build:
- ps: |
$ErrorActionPreference = "Stop"
$tagName = $env:APPVEYOR_REPO_TAG_NAME
if ($tagName -match '^v\d+\.\d+') # tag name starts with 'vX.Y'
{
$version = $tagName.Substring(1)
$env:SHOULD_PUBLISH_NUGET_PACKAGE = "true"
Write-Host "Will publish nuget package for $tagName tag" -ForegroundColor "Green"
if ($tagName -match '^v\d+\.\d+-release') # tag name starts with 'vX.Y-release' (e.g. use 'v4.2-release.1' tag for the first patch for release v4.2)
{
$version = $version.Substring(0, $version.IndexOf("-release"))
$env:SHOULD_CREATE_RELEASE = "true"
Write-Host "Will create release for $tagName tag" -ForegroundColor "Green"
}
$matchVersion = Select-String -Path ./version.json -Pattern "`"version`": `"$version`""
if ($matchVersion -eq $null)
{
Write-Error "Version in tag ($version) does not match version in version.json"
}
}
nuget:
disable_publish_on_pr: true

before_build:
- cmd: dotnet --info
- cmd: dotnet restore ./GroBuf.sln --verbosity m
- cmd: dotnet restore ./GroBuf.sln --verbosity minimal
- cmd: dotnet tool restore

build_script:
- cmd: dotnet build --configuration Release ./GroBuf.sln
- cmd: dotnet pack --no-build --configuration Release ./GroBuf.sln

test_script:
- cmd: dotnet jb cleanupcode GroBuf.sln --profile=CatalogueCleanup --verbosity=WARN
- cmd: git diff --exit-code
- cmd: dotnet test --no-build --configuration Release --filter TestCategory!=LongRunning ./GroBuf.Tests/GroBuf.Tests.csproj

artifacts:
Expand All @@ -43,7 +53,7 @@ deploy:
- provider: NuGet
server: https://nuget.org
api_key:
secure: y2RPf+gBBqffQVm8pg9qZcg99m7K8hsSa4z7VHvIE6t+kuO7r/oIqTVcryZzL93D
secure: 3Myenol+seNdEnkmH7tadxQLsmOE7VWQSp6vQii4vt2dX1S7XwjNV4T24HQTUsrr
skip_symbols: true
on:
SHOULD_PUBLISH_NUGET_PACKAGE: true
Expand Down
3 changes: 2 additions & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"sdk": {
"version": "5.0.103"
"version": "6.0.100",
"rollForward": "latestFeature"
}
}

0 comments on commit 4ba9cb3

Please sign in to comment.