Changed tests to explicitly assert for strings with \r\n

As opposed to leaving it up to the IDE to decide at compile time by having newlines in the actual document
This commit is contained in:
Redth
2014-09-09 09:35:01 -04:00
parent fc9c3ad720
commit aa6c474999
4 changed files with 7 additions and 74 deletions
@@ -808,10 +808,7 @@ namespace Newtonsoft.Json.Tests.Bson
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.String, reader.TokenType);
Assert.AreEqual(@"for (int i = 0; i < 1000; i++)
{
alert(arg1);
}", reader.Value);
Assert.AreEqual("for (int i = 0; i < 1000; i++)\r\n{\r\n alert(arg1);\r\n}", reader.Value);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
@@ -1299,12 +1296,7 @@ namespace Newtonsoft.Json.Tests.Bson
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.String, reader.TokenType);
Assert.AreEqual(@"<p>I'm the Director for Research and Development for <a href=""http://www.prophoenix.com"" rel=""nofollow"">ProPhoenix</a>, a public safety software company. This position allows me to investigate new and existing technologies and incorporate them into our product line, with the end goal being to help public safety agencies to do their jobs more effeciently and safely.</p>
<p>I'm an advocate for PowerShell, as I believe it encourages administrative best practices and allows developers to provide additional access to their applications, without needing to explicity write code for each administrative feature. Part of my advocacy for PowerShell includes <a href=""http://blog.usepowershell.com"" rel=""nofollow"">my blog</a>, appearances on various podcasts, and acting as a Community Director for <a href=""http://powershellcommunity.org"" rel=""nofollow"">PowerShellCommunity.Org</a></p>
<p>I’m also a co-host of Mind of Root (a weekly audio podcast about systems administration, tech news, and topics).</p>
", reader.Value);
Assert.AreEqual("<p>I'm the Director for Research and Development for <a href=\"http://www.prophoenix.com\" rel=\"nofollow\">ProPhoenix</a>, a public safety software company. This position allows me to investigate new and existing technologies and incorporate them into our product line, with the end goal being to help public safety agencies to do their jobs more effeciently and safely.</p>\r\n\r\n<p>I'm an advocate for PowerShell, as I believe it encourages administrative best practices and allows developers to provide additional access to their applications, without needing to explicity write code for each administrative feature. Part of my advocacy for PowerShell includes <a href=\"http://blog.usepowershell.com\" rel=\"nofollow\">my blog</a>, appearances on various podcasts, and acting as a Community Director for <a href=\"http://powershellcommunity.org\" rel=\"nofollow\">PowerShellCommunity.Org</a></p>\r\n\r\n<p>I’m also a co-host of Mind of Root (a weekly audio podcast about systems administration, tech news, and topics).</p>\r\n", reader.Value);
Assert.AreEqual(typeof(string), reader.ValueType);
Assert.IsTrue(reader.Read());
+2 -4
View File
@@ -342,8 +342,7 @@ namespace Newtonsoft.Json.Tests
result = JavaScriptUtils.ToEscapedJavaScriptString("How now <brown> cow?", '"', true);
Assert.AreEqual(@"""How now <brown> cow?""", result);
result = JavaScriptUtils.ToEscapedJavaScriptString(@"How
now brown cow?", '"', true);
result = JavaScriptUtils.ToEscapedJavaScriptString("How \r\nnow brown cow?", '"', true);
Assert.AreEqual(@"""How \r\nnow brown cow?""", result);
result = JavaScriptUtils.ToEscapedJavaScriptString("\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007", '"', true);
@@ -576,8 +575,7 @@ now brown cow?", '"', true);
[Test]
public void StringEscaping()
{
string v = @"It's a good day
""sunshine""";
string v = "It's a good day\r\n\"sunshine\"";
string json = JsonConvert.ToString(v);
Assert.AreEqual(@"""It's a good day\r\n\""sunshine\""""", json);
@@ -344,62 +344,7 @@ third line", jsonTextReader.Value);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.String, reader.TokenType);
Assert.AreEqual(@"#C16------------------------------
#C12Ingredients #C20
#C16------------------------------
a piece of Leather Armor
( ie #L ""Enhanced Leather Armor Boots"" ""85644"" )
<img src=rdb://13264>
#L ""Hacker Tool"" ""87814""
<img src=rdb://99282>
#L ""Clanalizer"" ""208313""
<img src=rdb://156479>
#C16------------------------------
#C12Recipe #C16
#C16------------------------------#C20
Hacker Tool
#C15+#C20
a piece of Leather Armor
#C15=#C20
<img src=rdb://13264>
a piece of Hacked Leather Armor
( ie : #L ""Hacked Leather Armor Boots"" ""245979"" )
#C16Skills: | BE |#C20
#C14------------------------------#C20
Clanalizer
#C15+#C20
a piece of Hacked Leather Armor
#C15=#C20
<img src=rdb://13264>
a piece of Apocalypse Leather Armor
( ie : #L ""Apocalypse Leather Armor Boots"" ""245966"" )
#C16Skills: | ?? |#C20
#C16------------------------------
#C12Details#C16
#C16------------------------------#C20
#L ""Apocalypse Leather Armor Boots"" ""245967""
#L ""Apocalypse Leather Armor Gloves"" ""245969""
#L ""Apocalypse Leather Armor Helmet"" ""245975""
#L ""Apocalypse Leather Armor Pants"" ""245971""
#L ""Apocalypse Leather Armor Sleeves"" ""245973""
#L ""Apocalypse Leather Body Armor"" ""245965""
#C16------------------------------
#C12Comments#C16
#C16------------------------------#C20
Nice froob armor.. but ugleh!
", reader.Value);
Assert.AreEqual("#C16------------------------------\r\n#C12Ingredients #C20\r\n#C16------------------------------\r\n\r\na piece of Leather Armor\r\n( ie #L \"Enhanced Leather Armor Boots\" \"85644\" )\r\n<img src=rdb://13264>\r\n\r\n#L \"Hacker Tool\" \"87814\"\r\n<img src=rdb://99282>\r\n\r\n#L \"Clanalizer\" \"208313\"\r\n<img src=rdb://156479>\r\n\r\n#C16------------------------------\r\n#C12Recipe #C16\r\n#C16------------------------------#C20\r\n\r\nHacker Tool\r\n#C15+#C20\r\na piece of Leather Armor\r\n#C15=#C20\r\n<img src=rdb://13264>\r\na piece of Hacked Leather Armor\r\n( ie : #L \"Hacked Leather Armor Boots\" \"245979\" )\r\n#C16Skills: | BE |#C20\r\n\r\n#C14------------------------------#C20\r\n\r\nClanalizer\r\n#C15+#C20\r\na piece of Hacked Leather Armor\r\n#C15=#C20\r\n<img src=rdb://13264>\r\na piece of Apocalypse Leather Armor\r\n( ie : #L \"Apocalypse Leather Armor Boots\" \"245966\" )\r\n#C16Skills: | ?? |#C20\r\n\r\n#C16------------------------------\r\n#C12Details#C16\r\n#C16------------------------------#C20\r\n\r\n#L \"Apocalypse Leather Armor Boots\" \"245967\"\r\n#L \"Apocalypse Leather Armor Gloves\" \"245969\"\r\n#L \"Apocalypse Leather Armor Helmet\" \"245975\"\r\n#L \"Apocalypse Leather Armor Pants\" \"245971\"\r\n#L \"Apocalypse Leather Armor Sleeves\" \"245973\"\r\n#L \"Apocalypse Leather Body Armor\" \"245965\"\r\n\r\n#C16------------------------------\r\n#C12Comments#C16\r\n#C16------------------------------#C20\r\n\r\nNice froob armor.. but ugleh!\r\n\r\n", reader.Value);
}
[Test]
@@ -1272,8 +1217,7 @@ Parameter name: reader",
Assert.IsTrue(reader.Read());
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
Assert.AreEqual(@"hi
bye", reader.Value);
Assert.AreEqual("hi\r\nbye", reader.Value);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.Integer, reader.TokenType);
Assert.AreEqual(1L, reader.Value);
@@ -261,8 +261,7 @@ namespace Newtonsoft.Json.Tests
jsonWriter.WriteStartArray();
jsonWriter.WriteValue(@"""These pretzels are making me thirsty!""");
jsonWriter.WriteValue("Jeff's house was burninated.");
jsonWriter.WriteValue(@"1. You don't talk about fight club.
2. You don't talk about fight club.");
jsonWriter.WriteValue("1. You don't talk about fight club.\r\n2. You don't talk about fight club.");
jsonWriter.WriteValue("35% of\t statistics\n are made\r up.");
jsonWriter.WriteEndArray();
}