From 03389737c72c455086d14144af4268de1b8fb7db Mon Sep 17 00:00:00 2001 From: Thomas Boby Date: Thu, 24 Oct 2024 07:57:25 +0100 Subject: [PATCH] Split test into one for each warning --- tests/IntegrationTests.fs | 28 +++++++++++++++++-- tests/fixtures/CHANGELOG.md | 19 +++++++++++++ .../FailIfChangelogDoesNotExist.fsproj | 20 +++++++++++++ ...roj => FailIfChangelogNotSpecified.fsproj} | 4 +-- 4 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 tests/fixtures/CHANGELOG.md create mode 100644 tests/fixtures/FailIfChangelogDoesNotExist.fsproj rename tests/fixtures/{DefaultToChangelogIfNotSpecified.fsproj => FailIfChangelogNotSpecified.fsproj} (86%) diff --git a/tests/IntegrationTests.fs b/tests/IntegrationTests.fs index d076119..9c12f40 100644 --- a/tests/IntegrationTests.fs +++ b/tests/IntegrationTests.fs @@ -130,9 +130,9 @@ type IntegrationTests() = } [] - member this.``fails with default CHANGELOG.md if no changelog is specified``() : Task = + member this.``fails if no changelog is specified``() : Task = task { - let projectName = "DefaultToChangelogIfNotSpecified.fsproj" + let projectName = "FailIfChangelogNotSpecified.fsproj" this.AddPackageReference projectName @@ -150,7 +150,31 @@ type IntegrationTests() = } } """ + ) + |> ignore + } + + [] + member this.``fails if changelog specified doesn't exist``() : Task = + task { + let projectName = "FailIfChangelogDoesNotExist.fsproj" + this.AddPackageReference projectName + + let! struct (stdout, _) = Utils.packAndGetPackageProperties projectName + + stdout + .ReplaceEscapedNewLines() + .Should() + .Be( + """{ + "Properties": { + "Version": "1.0.0", + "PackageVersion": "1.0.0", + "PackageReleaseNotes": "" + } +} +""" ) |> ignore } diff --git a/tests/fixtures/CHANGELOG.md b/tests/fixtures/CHANGELOG.md new file mode 100644 index 0000000..9d447ad --- /dev/null +++ b/tests/fixtures/CHANGELOG.md @@ -0,0 +1,19 @@ +# Changelog + +## [Unreleased] + +### Removed + +- A test removal line +- And another removal + +## [0.1.0] - 2022-01-13 + +### Added + +- Created the package + +### Changed + +- Changed something in the package +- Updated the target framework diff --git a/tests/fixtures/FailIfChangelogDoesNotExist.fsproj b/tests/fixtures/FailIfChangelogDoesNotExist.fsproj new file mode 100644 index 0000000..dd1973a --- /dev/null +++ b/tests/fixtures/FailIfChangelogDoesNotExist.fsproj @@ -0,0 +1,20 @@ + + + + + net6.0 + + + + $(MSBuildThisFileDirectory)CHANGELOG_NotHere.md + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/tests/fixtures/DefaultToChangelogIfNotSpecified.fsproj b/tests/fixtures/FailIfChangelogNotSpecified.fsproj similarity index 86% rename from tests/fixtures/DefaultToChangelogIfNotSpecified.fsproj rename to tests/fixtures/FailIfChangelogNotSpecified.fsproj index fbeb39e..b9a3b85 100644 --- a/tests/fixtures/DefaultToChangelogIfNotSpecified.fsproj +++ b/tests/fixtures/FailIfChangelogNotSpecified.fsproj @@ -6,8 +6,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all