From b98a1359acb1e5ab8fdbb5ae7f88ab34bf58f7c0 Mon Sep 17 00:00:00 2001 From: luantranminh Date: Sat, 17 Aug 2024 22:37:43 +0700 Subject: [PATCH] tests: remove CRLF when testing to make them run independently of the OS --- src/Atlas.Provider.Core/Program.cs | 1 - test/Atlas.Provider.Test/GenerateSchemaTest.cs | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Atlas.Provider.Core/Program.cs b/src/Atlas.Provider.Core/Program.cs index 3fa0031..4e2867a 100644 --- a/src/Atlas.Provider.Core/Program.cs +++ b/src/Atlas.Provider.Core/Program.cs @@ -45,7 +45,6 @@ static int Main(string[] args) Console.SetOut(originalOut); if (!string.IsNullOrEmpty(sql)) { - Console.Out.NewLine = "\n"; if (ctxInfo["ProviderName"]!.ToString()!.EndsWith("SqlServer")) { Console.WriteLine("-- atlas:delimiter GO"); diff --git a/test/Atlas.Provider.Test/GenerateSchemaTest.cs b/test/Atlas.Provider.Test/GenerateSchemaTest.cs index 88bd8a8..9cd0349 100644 --- a/test/Atlas.Provider.Test/GenerateSchemaTest.cs +++ b/test/Atlas.Provider.Test/GenerateSchemaTest.cs @@ -29,7 +29,10 @@ public void Can_generate_script(string providerName, string expectedFile) string output = process.StandardOutput.ReadToEnd(); string error = process.StandardError.ReadToEnd(); process.WaitForExit(); - Assert.Equal(FileReader.Read(expectedFile), output); + string expected = FileReader.Read(expectedFile); + // expectedFile is LF, defined in .gitattributes + // output is platform-specific, so normalize to LF + Assert.Equal(FileReader.Read(expectedFile), output.ReplaceLineEndings("\n")); Assert.Equal("", error); } }