From 5fc9a345f7bf446fefec9e6484db1198ea931350 Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Mon, 19 Feb 2018 17:22:47 -0800 Subject: [PATCH] Update root dir enum test (dotnet/corefx#27254) Update assert for better logging. Skip directory entries. fixes dotnet/corefx#27244 Commit migrated from https://github.com/dotnet/corefx/commit/59b2bfdc28ab814553601379392ebfe24eb610aa --- .../System.IO.FileSystem/tests/Enumeration/RootTests.netcoreapp.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.IO.FileSystem/tests/Enumeration/RootTests.netcoreapp.cs b/src/libraries/System.IO.FileSystem/tests/Enumeration/RootTests.netcoreapp.cs index b3b496d..55763c8 100644 --- a/src/libraries/System.IO.FileSystem/tests/Enumeration/RootTests.netcoreapp.cs +++ b/src/libraries/System.IO.FileSystem/tests/Enumeration/RootTests.netcoreapp.cs @@ -19,6 +19,9 @@ namespace System.IO.Tests.Enumeration { } + protected override bool ShouldIncludeEntry(ref FileSystemEntry entry) + => !entry.IsDirectory; + protected override string TransformEntry(ref FileSystemEntry entry) => entry.ToFullPath(); @@ -29,7 +32,6 @@ namespace System.IO.Tests.Enumeration } } - [ActiveIssue(27244)] [Fact] public void CanRecurseFromRoot() { @@ -45,7 +47,8 @@ namespace System.IO.Tests.Enumeration } // Should not get back a full path without a single separator (C:\foo.txt or /foo.txt) - Assert.Equal(Path.DirectorySeparatorChar, recursed.Current.SingleOrDefault(c => c == Path.DirectorySeparatorChar)); + int count = recursed.Current.Count(c => c == Path.DirectorySeparatorChar); + Assert.True(count <= 1, $"expected to find just one separator in '{recursed.Current}'"); } Assert.NotNull(recursed.LastDirectory); -- 2.7.4