From 7baa2fd3eeb46fe454651bea8c3e1fe5269a468c Mon Sep 17 00:00:00 2001 From: Philippe Matray Date: Thu, 2 Feb 2023 23:32:23 +0100 Subject: [PATCH 1/4] Fix a group of broken tests (VFS.ToString method) --- .../Models/VirtualFileSystemTests.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/Atypical.VirtualFileSystem.UnitTests/Models/VirtualFileSystemTests.cs b/tests/Atypical.VirtualFileSystem.UnitTests/Models/VirtualFileSystemTests.cs index 1217c2e..b963ae3 100644 --- a/tests/Atypical.VirtualFileSystem.UnitTests/Models/VirtualFileSystemTests.cs +++ b/tests/Atypical.VirtualFileSystem.UnitTests/Models/VirtualFileSystemTests.cs @@ -480,8 +480,7 @@ public void ToString_returns_3_files_as_ASCII_tree() ├── file1.txt ├── file2.txt └── file3.txt - """ - .Replace("\r", ""); + """; var vfs = new VFS() .CreateFile("file1.txt") @@ -504,8 +503,7 @@ public void ToString_returns_3_directories_as_ASCII_tree() ├── dir1 ├── dir2 └── dir3 - """ - .Replace("\r", ""); + """; var vfs = new VFS() .CreateDirectory("dir1") @@ -537,8 +535,7 @@ public void ToString_returns_3_files_and_3_directories_as_ASCII_tree() ├── file1.txt ├── file2.txt └── file3.txt - """ - .Replace("\r", ""); + """; var vfs = new VFS() .CreateFile("dir1/file1.txt") @@ -588,8 +585,7 @@ public void ToString_returns_a_complex_tree() ├── file1.txt ├── file2.txt └── file3.txt - """ - .Replace("\r", ""); + """; var vfs = new VFS() .CreateFile("dir1/dir2/dir3/file1.txt") From 63b01c3e69edf4a15dc1fff04296f08e24259771 Mon Sep 17 00:00:00 2001 From: Philippe Matray Date: Thu, 2 Feb 2023 23:46:54 +0100 Subject: [PATCH 2/4] Update VirtualFileSystemTests.cs Normalize the representation of the tree --- .../Models/VirtualFileSystemTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Atypical.VirtualFileSystem.UnitTests/Models/VirtualFileSystemTests.cs b/tests/Atypical.VirtualFileSystem.UnitTests/Models/VirtualFileSystemTests.cs index b963ae3..7077442 100644 --- a/tests/Atypical.VirtualFileSystem.UnitTests/Models/VirtualFileSystemTests.cs +++ b/tests/Atypical.VirtualFileSystem.UnitTests/Models/VirtualFileSystemTests.cs @@ -480,7 +480,7 @@ public void ToString_returns_3_files_as_ASCII_tree() ├── file1.txt ├── file2.txt └── file3.txt - """; + """.Normalize(); var vfs = new VFS() .CreateFile("file1.txt") @@ -503,7 +503,7 @@ public void ToString_returns_3_directories_as_ASCII_tree() ├── dir1 ├── dir2 └── dir3 - """; + """.Normalize(); var vfs = new VFS() .CreateDirectory("dir1") @@ -535,7 +535,7 @@ public void ToString_returns_3_files_and_3_directories_as_ASCII_tree() ├── file1.txt ├── file2.txt └── file3.txt - """; + """.Normalize(); var vfs = new VFS() .CreateFile("dir1/file1.txt") @@ -585,7 +585,7 @@ public void ToString_returns_a_complex_tree() ├── file1.txt ├── file2.txt └── file3.txt - """; + """.Normalize(); var vfs = new VFS() .CreateFile("dir1/dir2/dir3/file1.txt") From 2e75dd009582f34ed1ca00931b87c67a1a042b0c Mon Sep 17 00:00:00 2001 From: Philippe Matray Date: Thu, 2 Feb 2023 23:50:10 +0100 Subject: [PATCH 3/4] Update VFS.cs --- src/Atypical.VirtualFileSystem.Core/VFS.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Atypical.VirtualFileSystem.Core/VFS.cs b/src/Atypical.VirtualFileSystem.Core/VFS.cs index d4a1ab7..c30f02b 100644 --- a/src/Atypical.VirtualFileSystem.Core/VFS.cs +++ b/src/Atypical.VirtualFileSystem.Core/VFS.cs @@ -84,7 +84,7 @@ public override string ToString() sb.AppendLine(node.Path.Name); } - return sb.ToString().Trim(); + return sb.ToString().Trim().Normalize(); } /// From f61029197e39eaa9bcd1abaf08dea9b5b9f61cc0 Mon Sep 17 00:00:00 2001 From: Philippe Matray Date: Thu, 2 Feb 2023 23:57:10 +0100 Subject: [PATCH 4/4] Try with ReplaceLineEndings to fix the GitHub action --- src/Atypical.VirtualFileSystem.Core/VFS.cs | 2 +- .../Models/VirtualFileSystemTests.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Atypical.VirtualFileSystem.Core/VFS.cs b/src/Atypical.VirtualFileSystem.Core/VFS.cs index c30f02b..a4edb98 100644 --- a/src/Atypical.VirtualFileSystem.Core/VFS.cs +++ b/src/Atypical.VirtualFileSystem.Core/VFS.cs @@ -84,7 +84,7 @@ public override string ToString() sb.AppendLine(node.Path.Name); } - return sb.ToString().Trim().Normalize(); + return sb.ToString().Trim().ReplaceLineEndings(); } /// diff --git a/tests/Atypical.VirtualFileSystem.UnitTests/Models/VirtualFileSystemTests.cs b/tests/Atypical.VirtualFileSystem.UnitTests/Models/VirtualFileSystemTests.cs index 7077442..9fe4060 100644 --- a/tests/Atypical.VirtualFileSystem.UnitTests/Models/VirtualFileSystemTests.cs +++ b/tests/Atypical.VirtualFileSystem.UnitTests/Models/VirtualFileSystemTests.cs @@ -480,7 +480,7 @@ public void ToString_returns_3_files_as_ASCII_tree() ├── file1.txt ├── file2.txt └── file3.txt - """.Normalize(); + """.ReplaceLineEndings(); var vfs = new VFS() .CreateFile("file1.txt") @@ -503,7 +503,7 @@ public void ToString_returns_3_directories_as_ASCII_tree() ├── dir1 ├── dir2 └── dir3 - """.Normalize(); + """.ReplaceLineEndings(); var vfs = new VFS() .CreateDirectory("dir1") @@ -535,7 +535,7 @@ public void ToString_returns_3_files_and_3_directories_as_ASCII_tree() ├── file1.txt ├── file2.txt └── file3.txt - """.Normalize(); + """.ReplaceLineEndings(); var vfs = new VFS() .CreateFile("dir1/file1.txt") @@ -585,7 +585,7 @@ public void ToString_returns_a_complex_tree() ├── file1.txt ├── file2.txt └── file3.txt - """.Normalize(); + """.ReplaceLineEndings(); var vfs = new VFS() .CreateFile("dir1/dir2/dir3/file1.txt")