Skip to content

Commit

Permalink
Normalize line endings for tests which are sensitive to line ending
Browse files Browse the repository at this point in the history
This fixes tests that don't pass on Linux/macOS or Windows when git is configured with core.autocrlf=false
  • Loading branch information
0xced committed May 9, 2022
1 parent 9d6ebf3 commit 4e4bda4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Tomlyn.Tests/ModelTests/ReflectionModelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ public void TestCommentRoundtripWithModel()
[[array]] # a comment after a table array
key2 = 3
# This is a comment after a key
";
".ReplaceLineEndings();

StandardTests.DisplayHeader("input");
Console.WriteLine(input);
var model = Toml.ToModel(input);
Expand Down
3 changes: 2 additions & 1 deletion src/Tomlyn.Tests/SerializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the BSD-Clause 2 license.
// See license.txt file in the project root for full license information.

using System;
using NUnit.Framework;
using Tomlyn.Model;

Expand All @@ -23,7 +24,7 @@ public void TestCrlfInMultilineString()

model["property"] = "string\r\nwith\r\nnewlines";

Assert.AreEqual("property = '''string\r\nwith\r\nnewlines'''\r\n", Toml.FromModel(model));
Assert.AreEqual("property = '''string\r\nwith\r\nnewlines'''" + Environment.NewLine, Toml.FromModel(model));
}
}
}
3 changes: 2 additions & 1 deletion src/Tomlyn.Tests/TomlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public void TestDescendants()
test.sub.key = ""yes""
[[array]]
hello = true
";
".ReplaceLineEndings("\r\n");

var tokens = Toml.Parse(input).Tokens().ToList();
var builder = new StringBuilder();
foreach (var node in tokens)
Expand Down

0 comments on commit 4e4bda4

Please sign in to comment.