Skip to content

Commit

Permalink
Merge pull request #22 from wildbit/task/add-support-for-unsigned-types
Browse files Browse the repository at this point in the history
Add support for unsigned integral data types
  • Loading branch information
vladsandu authored Jun 24, 2019
2 parents d9a8773 + 3342716 commit 7ea435f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
13 changes: 12 additions & 1 deletion Mustachio.Tests/TemplateFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Mustachio.Tests
{
public class TemplateFixture
{

[Fact]
public void TemplateRendersContentWithNoVariables()
{
Expand Down Expand Up @@ -71,6 +71,17 @@ public void NegationGroupRendersContentWhenValueNotSet()
Assert.Equal("No Stuff Here.", rendered);
}

[Fact]
public void UnsignedIntegralTypeModelVariablesAreSupported()
{
var model = new Dictionary<string, object>(){
{"uint", (uint)123},
{"ushort", (ushort)234},
{"ulong", (ulong)18446744073709551615} // max ulong
};

Assert.Equal("123;234;18446744073709551615", Parser.Parse("{{uint}};{{ushort}};{{ulong}}")(model));
}

[Fact]
public void TemplateRendersWithComplextEachPath()
Expand Down
8 changes: 7 additions & 1 deletion Mustachio/ContextObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ public bool Exists()
typeof(byte),
typeof(sbyte),
typeof(decimal),
typeof(uint),
typeof(ushort),
typeof(ulong),
typeof(int?),
typeof(bool?),
typeof(double?),
Expand All @@ -109,7 +112,10 @@ public bool Exists()
typeof(long?),
typeof(byte?),
typeof(sbyte?),
typeof(decimal?)
typeof(decimal?),
typeof(uint?),
typeof(ushort?),
typeof(ulong?)
};

public override string ToString()
Expand Down

0 comments on commit 7ea435f

Please sign in to comment.