Imported Upstream version 4.2.0.179

Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent 183bba2c9a
commit 6992685b86
7507 changed files with 90259 additions and 657307 deletions

View File

@ -1400,5 +1400,46 @@ namespace MonoTests.System.Web.Script.Serialization
Assert.AreEqual (kv.Value, obj.Value);
}
}
[Test]
public void DeserializeStringWithNewline ()
{
JavaScriptSerializer serializer = new JavaScriptSerializer ();
string json_with_newline = @"
[
{
content:""
<div id=\""calendar\""><div>
""
}
]
";
serializer.DeserializeObject (json_with_newline);
}
class Dummy
{
public bool t;
public bool f;
public string s;
public int i;
public double d;
public object o;
}
[Test]
public void DeserializeWhiteSpaces ()
{
string json = "{\"t\" : true , \"f\" : false , \"s\" : \"s\" , \"i\" : 1337 , \"d\" : 1337.0 , \"o\" : null }";
var obj = (new JavaScriptSerializer ()).Deserialize<Dummy>(json);
Assert.IsTrue (obj.t);
Assert.IsFalse (obj.f);
Assert.AreEqual ("s", obj.s);
Assert.AreEqual (1337, obj.i);
Assert.AreEqual (1337.0, obj.d);
Assert.AreEqual (null, obj.o);
}
}
}