Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/app/Fake.Core.ReleaseNotes/Changelog.fs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,14 @@ module Changelog =
RepoUrl = Uri(uri) })

let newLastEntry =
ChangelogEntry.New(last.AssemblyVersion, last.NuGetVersion, trueChanges)
ChangelogEntry.New(
last.AssemblyVersion,
last.NuGetVersion,
last.Date,
last.Description,
trueChanges,
last.IsYanked
)

front @ [ newLastEntry ], references

Expand Down
39 changes: 39 additions & 0 deletions src/test/Fake.Core.UnitTests/Fake.Core.ReleaseNotes.fs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@ let private changelogReferencesText =
[0.1.0-pre.2]: https://github.com/bogus/Foo/releases/tag/v0.1.0-pre.2
[0.1.0-pre.1]: https://github.com/bogus/Foo/releases/tag/v0.1.0-pre.1"""

[<Literal>]
let private changelogOneReleaseText =
"""# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Changed
- Foo 2

## [0.1.0-pre.1] - 2023-10-11

### Added
- Foo 0"""

[<Tests>]
let tests =
testList
Expand Down Expand Up @@ -288,6 +307,26 @@ let tests =
Expect.isEmpty changelog.References "References not empty"
Expect.isSome changelog.Unreleased "Unreleased section empty"
Expect.hasLength changelog.Entries 2 "Wrong number of release entries parsed"

let latestEntry = changelog.LatestEntry
let oldestEntry = changelog.Entries |> List.last

Expect.isSome latestEntry.Date "Latest entry had no date"
Expect.isSome latestEntry.Description "Latest entry had no description"
Expect.isSome oldestEntry.Date "Oldest entry had no date"
Expect.isSome oldestEntry.Description "Oldest entry had no description"
testCase "Test that we can parse changelog without references with just one release"
<| fun _ ->
let changelog = changelogOneReleaseText |> String.splitStr "\n" |> Changelog.parse

Expect.isEmpty changelog.References "References not empty"
Expect.isSome changelog.Unreleased "Unreleased section empty"
Expect.hasLength changelog.Entries 1 "Wrong number of release entries parsed"

let latestEntry = changelog.LatestEntry

Expect.isSome latestEntry.Date "Latest entry had no date"
Expect.isSome latestEntry.Description "Latest entry had no description"
testCase "Test that we can parse changelog with references"
<| fun _ ->
let changelogText = changelogReleasesText + "\n\n" + changelogReferencesText
Expand Down
Loading