Skip to content

Commit

Permalink
Split test into one for each warning
Browse files Browse the repository at this point in the history
  • Loading branch information
tboby committed Oct 24, 2024
1 parent f1ac912 commit 0338973
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 4 deletions.
28 changes: 26 additions & 2 deletions tests/IntegrationTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ type IntegrationTests() =
}

[<TestMethod>]
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

Expand All @@ -150,7 +150,31 @@ type IntegrationTests() =
}
}
"""
)
|> ignore
}

[<TestMethod>]
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
}
19 changes: 19 additions & 0 deletions tests/fixtures/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions tests/fixtures/FailIfChangelogDoesNotExist.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<ChangelogFile>$(MSBuildThisFileDirectory)CHANGELOG_NotHere.md</ChangelogFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DotNet.ReproducibleBuilds.Isolated" Version="1.2.25" />
<PackageReference Include="Ionide.KeepAChangelog.Tasks" Version="[0.0.1-test-FailIfChangelogDoesNotExist]">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DotNet.ReproducibleBuilds.Isolated" Version="1.2.25"/>
<PackageReference Include="Ionide.KeepAChangelog.Tasks" Version="[0.0.1-test-DefaultToChangelogIfNotSpecified]" >
<PackageReference Include="DotNet.ReproducibleBuilds.Isolated" Version="1.2.25" />
<PackageReference Include="Ionide.KeepAChangelog.Tasks" Version="[0.0.1-test-FailIfChangelogNotSpecified]">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down

0 comments on commit 0338973

Please sign in to comment.