Skip to content

Commit

Permalink
[tests] we don't need to check if Clean deletes directories (#6117)
Browse files Browse the repository at this point in the history
Context: #6112

The .NET 6 Preview 7 bump had a test failure:

    CleanBasicBindingLibrary("class-parse")
    obj/Release should have no directories.
    Expected: <empty>
    But was:  < "/Users/runner/work/1/s/bin/TestRelease/temp/CleanBasicBindingLibraryclass-parse/obj/Release/refint" >

`refint` is a new directory, see:

* dotnet/sdk@e424c0e
* https://github.com/dotnet/msbuild/blob/9e576281e638d60701ca34411e2483bed01e35c7/src/Tasks/Microsoft.Common.CurrentVersion.targets#L397

Clean doesn't actually delete directories, no need to test for this.

The test already is checking if any files exist, and that should be
sufficient.
  • Loading branch information
jonathanpeppers authored Jul 23, 2021
1 parent 96eb449 commit 97e543a
Showing 1 changed file with 0 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,6 @@ public void CleanBasicBindingLibrary (string classParser)
};
var files = Directory.GetFiles (Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath), "*", SearchOption.AllDirectories)
.Where (x => !ignoreFiles.Any (i => !Path.GetFileName (x).Contains (i)));
var directories = Directory.GetDirectories (Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath), "*", SearchOption.AllDirectories)
// designtime folder is left behind, so Intellisense continues to work after a Clean
.Where (x => Path.GetFileName (x) != "designtime")
// .NET 5+ sets $(ProduceReferenceAssembly) by default
// https://github.com/dotnet/sdk/blob/18ee4eac8b3abe6d554d2e0c39d8952da0f23ce5/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets#L242-L244
.Where (x => Path.GetFileName (x) != "ref");
CollectionAssert.IsEmpty (directories, $"{proj.IntermediateOutputPath} should have no directories.");
CollectionAssert.IsEmpty (files, $"{proj.IntermediateOutputPath} should have no files.");
}
}
Expand Down

0 comments on commit 97e543a

Please sign in to comment.