Merge pull request #496 from nicolas-raoul/unit-test-for-issue2907
[mono.git] / mcs / class / System.Json / Test / System.Json / JsonValueTest.cs
index 754f8556a5fea0dbef54f21fdc055342afd69f8e..2459c1fc3ad0f27478d902ffaccc6f2ec3f0d371 100644 (file)
@@ -25,5 +25,15 @@ namespace MonoTests.System
                        Assert.AreEqual (JsonType.String, j ["a"].JsonType, "type");
                        Assert.AreEqual ("b", (string) j ["a"], "value");
                }
+
+               // Test that we correctly serialize JsonArray with null elements.
+               [Test]
+               public void ToStringOnJsonArrayWithNulls () {
+                       var j = JsonValue.Load (new StringReader ("[1,2,3,null]"));
+                       Assert.AreEqual (4, j.Count, "itemcount");
+                       Assert.AreEqual (JsonType.Array, j.JsonType, "type");
+                       var str = j.ToString ();
+                       Assert.AreEqual (str, "[1, 2, 3, null]");
+               }
        }
 }