Skip to content

Commit

Permalink
Add unit test for negative integers.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaubry committed Feb 1, 2016
1 parent c777efe commit 6f467fe
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions YamlDotNet.Test/Serialization/SerializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,10 +1020,10 @@ public void SpecialFloatsAreDeserializedCorrectly()
[Fact]
public void SpecialFloatsAreSerializedCorrectly()
{
var deserializer = new Serializer();
var serializer = new Serializer();

var buffer = new StringWriter();
deserializer.Serialize(buffer, new double[]
serializer.Serialize(buffer, new double[]
{
double.NaN,
double.PositiveInfinity,
Expand All @@ -1037,6 +1037,17 @@ public void SpecialFloatsAreSerializedCorrectly()
Assert.Contains("- -.inf", text);
}

[Fact]
public void NegativeIntegersCanBeDeserialized()
{
var deserializer = new Deserializer();

var value = deserializer.Deserialize<int>(Yaml.ReaderForText(@"
'-123'
"));
Assert.Equal(-123, value);
}

#region Test Dictionary that implements IDictionary<,>, but not IDictionary
public class GenericTestDictionary<TKey, TValue> : IDictionary<TKey, TValue>
{
Expand Down

0 comments on commit 6f467fe

Please sign in to comment.