Skip to content

Commit

Permalink
Cleanup of csproj
Browse files Browse the repository at this point in the history
  • Loading branch information
thompson-tomo committed Apr 1, 2024
1 parent 8d795f3 commit 7331333
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 77 deletions.
16 changes: 8 additions & 8 deletions source/Handlebars.Test/DynamicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class EnvGenerator : IEnumerable<object[]>

IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}

[Fact]
public void DynamicObjectBasicTest()
{
Expand All @@ -36,7 +36,7 @@ public void DynamicObjectBasicTest()

Assert.Equal("Foo: 1\nBar: hello world", output);
}

[Fact]
public void DynamicObjectBasicIterationTest()
{
Expand Down Expand Up @@ -106,7 +106,7 @@ public void JsonTestArrays(IHandlebars handlebars){

Assert.Equal("Key1Val1Key2Val2", output);
}

[Theory]
[ClassData(typeof(EnvGenerator))]
public void JsonTestArrayCount(IHandlebars handlebars)
Expand All @@ -121,7 +121,7 @@ public void JsonTestArrayCount(IHandlebars handlebars)

Assert.Equal("2", output);
}

[Theory]
[ClassData(typeof(EnvGenerator))]
public void JsonTestObjects(IHandlebars handlebars){
Expand Down Expand Up @@ -150,7 +150,7 @@ public void JObjectTest(IHandlebars handlebars) {

Assert.Equal("", output);
}

[Theory]
[ClassData(typeof(EnvGenerator))]
public void WithParentIndexJsonNet(IHandlebars handlebars)
Expand All @@ -174,7 +174,7 @@ public void WithParentIndexJsonNet(IHandlebars handlebars)
{{/each}}
{{/each}}
{{/each}}";

var template = handlebars.Compile( source );
var data = new
{
Expand Down Expand Up @@ -281,13 +281,13 @@ public void WithParentIndexJsonNet(IHandlebars handlebars)
index=[1:1:1]
first=[False:False:False]
last=[True:True:True]";

Func<string, string> makeFlat = text => text.Replace( " ", "" ).Replace( "\n", "" ).Replace( "\r", "" );

Assert.Equal( makeFlat( expected ), makeFlat( result ) );
}

#if !netstandard
#if NET452 || NET46 || NET461 || NET472

[Fact]
public void SystemJsonTestArrays()
Expand Down
30 changes: 0 additions & 30 deletions source/Handlebars.Test/Handlebars.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,9 @@
<SignAssembly>false</SignAssembly>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

<PropertyGroup>
<NoWarn>0618;1701</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net472'">
<DefineConstants>$(DefineConstants);netFramework</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net461'">
<DefineConstants>$(DefineConstants);netFramework</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net46'">
<DefineConstants>$(DefineConstants);netFramework</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net452'">
<DefineConstants>$(DefineConstants);netFramework</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp2.1'">
<DefineConstants>$(DefineConstants);netcoreapp;netstandard</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp3.1'">
<DefineConstants>$(DefineConstants);netcoreapp;netstandard</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net5'">
<DefineConstants>$(DefineConstants);netcoreapp;netstandard;net</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net6'">
<DefineConstants>$(DefineConstants);netcoreapp;netstandard;net</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Handlebars\Handlebars.csproj" />
</ItemGroup>
Expand Down
19 changes: 0 additions & 19 deletions source/Handlebars/Handlebars.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,6 @@
<Version>2.0.0</Version>
<RootNamespace>HandlebarsDotNet</RootNamespace>
<SignAssembly Condition="'$(ShouldSignAssembly)' == 'true'">true</SignAssembly>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='netstandard1.3'">
<DefineConstants>$(DefineConstants);netstandard;netstandard1_3</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<DefineConstants>$(DefineConstants);netstandard</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net451'">
<DefineConstants>$(DefineConstants);NET451</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net452'">
<DefineConstants>$(DefineConstants);NET452</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net46'">
<DefineConstants>$(DefineConstants);NET46</DefineConstants>
</PropertyGroup>

<PropertyGroup>
<Authors>Rex Morgan</Authors>
<Copyright>Copyright © 2014-2020 Rex Morgan</Copyright>
<Description>Blistering-fast Handlebars.js templates in your .NET application.</Description>
Expand Down
40 changes: 20 additions & 20 deletions source/Handlebars/IO/EncodedTextWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ public bool SuppressEncoding
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => !_encoder.Enabled;

[MethodImpl(MethodImplOptions.AggressiveInlining)]
set => _encoder.Enabled = !value;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public EncodedTextWriter(
TextWriter writer,
ITextEncoder encoder,
IFormatterProvider formatterProvider,
ITextEncoder encoder,
IFormatterProvider formatterProvider,
bool suppressEncoding = false)
{
UnderlyingWriter = writer;
_formatterProvider = formatterProvider;
_encoder = encoder != null
? TextEncoderWrapper.Create(encoder)
_encoder = encoder != null
? TextEncoderWrapper.Create(encoder)
: TextEncoderWrapper.Null;

SuppressEncoding = suppressEncoding;
}

Expand All @@ -52,7 +52,7 @@ public void Write(string value, bool encode)
_encoder.Encode(value, UnderlyingWriter);
return;
}

UnderlyingWriter.Write(value);
}

Expand All @@ -70,7 +70,7 @@ public void Write(StringBuilder value, bool encode = true)
UnderlyingWriter.Write(value[i]);
}
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Write(Substring value, bool encode = true)
{
Expand All @@ -85,7 +85,7 @@ public void Write(Substring value, bool encode = true)
UnderlyingWriter.Write(value[i]);
}
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Write<T>(T value, bool encode) where T: IEnumerator<char>
{
Expand All @@ -100,7 +100,7 @@ public void Write<T>(T value, bool encode) where T: IEnumerator<char>
UnderlyingWriter.Write(value.Current);
}
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Write(string value) => Write(value, true);

Expand All @@ -119,26 +119,26 @@ public void Write<T>(T value)
switch (value)
{
case null:
case string v when string.IsNullOrEmpty(v):
case string v when string.IsNullOrEmpty(v):
case StringBuilder st when st.Length == 0:
case Substring substring when substring.Length == 0:
return;

case string v: Write(v, true); return;
case StringBuilder v: Write(v, true); return;
case Substring v: Write(v, true); return;
case Substring v: Write(v, true); return;

default:
WriteFormatted(value);
return;
}
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void WriteFormatted<T>(T value)
{
var type = typeof(T);
#if netstandard1_3
#if NETSTANDARD1_3
if (type.GetTypeInfo().IsClass) type = value.GetType();
#else
if (type.IsClass) type = value.GetType();
Expand All @@ -155,11 +155,11 @@ public Encoding Encoding
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => UnderlyingWriter.Encoding;
}

public void Dispose() => _encoder.Dispose();

public override string ToString() => UnderlyingWriter.ToString();

private static class Throw
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down

0 comments on commit 7331333

Please sign in to comment.