Skip to content

Commit 7ea435f

Browse files
authored
Merge pull request #22 from wildbit/task/add-support-for-unsigned-types
Add support for unsigned integral data types
2 parents d9a8773 + 3342716 commit 7ea435f

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

Mustachio.Tests/TemplateFixture.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Mustachio.Tests
99
{
1010
public class TemplateFixture
1111
{
12-
12+
1313
[Fact]
1414
public void TemplateRendersContentWithNoVariables()
1515
{
@@ -71,6 +71,17 @@ public void NegationGroupRendersContentWhenValueNotSet()
7171
Assert.Equal("No Stuff Here.", rendered);
7272
}
7373

74+
[Fact]
75+
public void UnsignedIntegralTypeModelVariablesAreSupported()
76+
{
77+
var model = new Dictionary<string, object>(){
78+
{"uint", (uint)123},
79+
{"ushort", (ushort)234},
80+
{"ulong", (ulong)18446744073709551615} // max ulong
81+
};
82+
83+
Assert.Equal("123;234;18446744073709551615", Parser.Parse("{{uint}};{{ushort}};{{ulong}}")(model));
84+
}
7485

7586
[Fact]
7687
public void TemplateRendersWithComplextEachPath()

Mustachio/ContextObject.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ public bool Exists()
100100
typeof(byte),
101101
typeof(sbyte),
102102
typeof(decimal),
103+
typeof(uint),
104+
typeof(ushort),
105+
typeof(ulong),
103106
typeof(int?),
104107
typeof(bool?),
105108
typeof(double?),
@@ -109,7 +112,10 @@ public bool Exists()
109112
typeof(long?),
110113
typeof(byte?),
111114
typeof(sbyte?),
112-
typeof(decimal?)
115+
typeof(decimal?),
116+
typeof(uint?),
117+
typeof(ushort?),
118+
typeof(ulong?)
113119
};
114120

115121
public override string ToString()

0 commit comments

Comments
 (0)