Unverified Commit 6fc04c3f authored by Jan Tattermusch's avatar Jan Tattermusch Committed by GitHub

Merge pull request #6832 from ObsidianMinor/csharp/test-overhaul

Move generated test code for Google.Protobuf.Test to a separate lib
parents 668eb3b4 cbafc68d
......@@ -127,21 +127,22 @@ csharp_EXTRA_DIST= \
csharp/src/Google.Protobuf.Test/SampleMessages.cs \
csharp/src/Google.Protobuf.Test/SampleNaNs.cs \
csharp/src/Google.Protobuf.Test/TestCornerCases.cs \
csharp/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs \
csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs \
csharp/src/Google.Protobuf.Test/TestProtos/OldExtensions1.cs \
csharp/src/Google.Protobuf.Test/TestProtos/OldExtensions2.cs \
csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto2.cs \
csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs \
csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs \
csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs \
csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs \
csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublic.cs \
csharp/src/Google.Protobuf.Test/TestProtos/UnittestImport.cs \
csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs \
csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs \
csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs \
csharp/src/Google.Protobuf.Test/TestProtos/Unittest.cs \
csharp/src/Google.Protobuf.Test.TestProtos/Google.Protobuf.Test.TestProtos.csproj \
csharp/src/Google.Protobuf.Test.TestProtos/ForeignMessagePartial.cs \
csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs \
csharp/src/Google.Protobuf.Test.TestProtos/OldExtensions1.cs \
csharp/src/Google.Protobuf.Test.TestProtos/OldExtensions2.cs \
csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs \
csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.cs \
csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.cs \
csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.cs \
csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.cs \
csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.cs \
csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs \
csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs \
csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs \
csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs \
csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs \
csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs \
csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs \
csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs \
......
......@@ -45,7 +45,7 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \
# and old_extensions2.proto, which are generated with an older version
# of protoc.
$PROTOC -Isrc -Icsharp/protos \
--csharp_out=csharp/src/Google.Protobuf.Test/TestProtos \
--csharp_out=csharp/src/Google.Protobuf.Test.TestProtos \
--descriptor_set_out=csharp/src/Google.Protobuf.Test/testprotos.pb \
--include_source_info \
--include_imports \
......
......@@ -39,7 +39,7 @@ namespace Google.Protobuf.TestProtos
{
public string ToDiagnosticString()
{
return $"{{ \"c\": {C}, \"@cInHex\": \"{C:x}\" }}";
return string.Format("{{ \"c\": {0}, \"@cInHex\": \"{0:x}\" }}", C);
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<!--
This TestProtos project is kept separate from the original test project for many reasons.
It allows us to make sure code can compile on a separate compiler version, different frameworks,
and without the internal visibility from the test project (all of which have caused issues in the past).
-->
<PropertyGroup>
<TargetFrameworks>net45;netstandard1.0;netstandard2.0</TargetFrameworks>
<LangVersion>3.0</LangVersion>
<AssemblyOriginatorKeyFile>../../keys/Google.Protobuf.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<IsPackable>False</IsPackable>
</PropertyGroup>
<!-- Needed for the net45 build to work on Unix. See https://github.com/dotnet/designs/pull/33 -->
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.2" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Google.Protobuf\Google.Protobuf.csproj" />
</ItemGroup>
</Project>
......@@ -10,6 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\Google.Protobuf\Google.Protobuf.csproj" />
<ProjectReference Include="..\Google.Protobuf.Test.TestProtos\Google.Protobuf.Test.TestProtos.csproj"/>
</ItemGroup>
<ItemGroup>
......
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26114.2
MinimumVisualStudioVersion = 10.0.40219.1
......@@ -14,6 +14,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Google.Protobuf.JsonDump",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google.Protobuf.Benchmarks", "Google.Protobuf.Benchmarks\Google.Protobuf.Benchmarks.csproj", "{D25E4804-4DEA-45AB-9F8C-BA4DBD8E5A07}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google.Protobuf.Test.TestProtos", "Google.Protobuf.Test.TestProtos\Google.Protobuf.Test.TestProtos.csproj", "{ADF24BEB-A318-4530-8448-356B72B820EA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -44,6 +46,10 @@ Global
{D25E4804-4DEA-45AB-9F8C-BA4DBD8E5A07}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D25E4804-4DEA-45AB-9F8C-BA4DBD8E5A07}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D25E4804-4DEA-45AB-9F8C-BA4DBD8E5A07}.Release|Any CPU.Build.0 = Release|Any CPU
{ADF24BEB-A318-4530-8448-356B72B820EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ADF24BEB-A318-4530-8448-356B72B820EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ADF24BEB-A318-4530-8448-356B72B820EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ADF24BEB-A318-4530-8448-356B72B820EA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment