Skip to content

Commit

Permalink
Update ReleaseNotesSpecs tests to handle parsed dates from notes
Browse files Browse the repository at this point in the history
Currently failing because the date "2013/11/5" isn't being caught by the
regular expression being used.
  • Loading branch information
allykzam committed Aug 21, 2015
1 parent 84ccf22 commit 43de5cf
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/test/Test.FAKECore/ReleaseNotesSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class when_parsing_release_notes

static readonly ReleaseNotesHelper.ReleaseNotes expected = ReleaseNotesHelper.ReleaseNotes.New("1.1.10",
"1.1.10",
new Microsoft.FSharp.Core.FSharpOption<DateTime>(new DateTime(2013, 09, 12)),
new[]
{
"Support for heterogeneous XML attributes.",
Expand All @@ -52,20 +53,20 @@ public class when_parsing_release_notes

It should_parse_empty_notes =
() => ReleaseNotesHelper.parseReleaseNotes(Notes.FromString(@"### New in 1.1.10 (Released 2013/09/12)"))
.ShouldEqual(ReleaseNotesHelper.ReleaseNotes.New("1.1.10", "1.1.10", FSharpList<string>.Empty));
.ShouldEqual(ReleaseNotesHelper.ReleaseNotes.New("1.1.10", "1.1.10", new Microsoft.FSharp.Core.FSharpOption<DateTime>(new DateTime(2013, 09, 12)), FSharpList<string>.Empty));

It should_parse_simple_format =
() => ReleaseNotesHelper.parseReleaseNotes(Notes.FromString(@"
* 1.1.9 - Infer booleans for ints that only manifest 0 and 1. Support for partially overriding the Schema in CsvProvider.
* 1.1.10 - Support for heterogeneous XML attributes. Make CsvFile re-entrant."))
.ShouldEqual(ReleaseNotesHelper.ReleaseNotes.New("1.1.10", "1.1.10",
.ShouldEqual(ReleaseNotesHelper.ReleaseNotes.New("1.1.10", "1.1.10", null,
new[] {"Support for heterogeneous XML attributes.", "Make CsvFile re-entrant."}.ToFSharpList()));


It should_parse_simple_format_with_dots =
() => ReleaseNotesHelper.parseReleaseNotes(Notes.FromString(@"
* 1.2.0 - Allow currency symbols on decimals. Remove .AsTuple member from CsvProvider. CsvProvider now uses GetSample instead of constructor like the other providers."))
.ShouldEqual(ReleaseNotesHelper.ReleaseNotes.New("1.2.0", "1.2.0",
.ShouldEqual(ReleaseNotesHelper.ReleaseNotes.New("1.2.0", "1.2.0", null,
new[]
{
"Allow currency symbols on decimals.", "Remove .AsTuple member from CsvProvider.",
Expand Down Expand Up @@ -98,7 +99,7 @@ public class when_parsing_many_alpha_versions
#### 2.0.0-alpha001 - December 15 2013
* A";
static readonly ReleaseNotesHelper.ReleaseNotes expected =
ReleaseNotesHelper.ReleaseNotes.New("2.0.0", "2.0.0-alpha2", new[] { "B" }.ToFSharpList());
ReleaseNotesHelper.ReleaseNotes.New("2.0.0", "2.0.0-alpha2", null, new[] { "B" }.ToFSharpList());

It should_parse =
() => ReleaseNotesHelper.parseReleaseNotes(Notes.FromString(input)).ShouldEqual(expected);
Expand Down Expand Up @@ -131,7 +132,7 @@ public class when_parsing_many_pre_release_versions
#### 2.0.0-alpha001 - December 15 2013
* A";
static readonly ReleaseNotesHelper.ReleaseNotes expected =
ReleaseNotesHelper.ReleaseNotes.New("2.0.0", "2.0.0-rc007", new[] { "A" }.ToFSharpList());
ReleaseNotesHelper.ReleaseNotes.New("2.0.0", "2.0.0-rc007", null, new[] { "A" }.ToFSharpList());

It should_parse =
() => ReleaseNotesHelper.parseReleaseNotes(Notes.FromString(input)).ShouldEqual(expected);
Expand Down Expand Up @@ -159,6 +160,7 @@ public class when_parsing_release_notes_in_reverse_order

static readonly ReleaseNotesHelper.ReleaseNotes expected = ReleaseNotesHelper.ReleaseNotes.New("1.1.10",
"1.1.10",
new Microsoft.FSharp.Core.FSharpOption<DateTime>(new DateTime(2013, 09, 12)),
new[]
{
"Support for heterogeneous XML attributes.",
Expand All @@ -174,13 +176,13 @@ public class when_parsing_release_notes_in_reverse_order

It should_parse_empty_notes =
() => ReleaseNotesHelper.parseReleaseNotes(Notes.FromString(@"### New in 1.1.10 (Released 2013/09/12)"))
.ShouldEqual(ReleaseNotesHelper.ReleaseNotes.New("1.1.10", "1.1.10", FSharpList<string>.Empty));
.ShouldEqual(ReleaseNotesHelper.ReleaseNotes.New("1.1.10", "1.1.10", new Microsoft.FSharp.Core.FSharpOption<DateTime>(new DateTime(2013, 09, 12)), FSharpList<string>.Empty));

It should_parse_simple_format =
() => ReleaseNotesHelper.parseReleaseNotes(Notes.FromString(@"
* 1.1.10 - Support for heterogeneous XML attributes. Make CsvFile re-entrant.
* 1.0.9 - Infer booleans for ints that only manifest 0 and 1. Support for partially overriding the Schema in CsvProvider."))
.ShouldEqual(ReleaseNotesHelper.ReleaseNotes.New("1.1.10", "1.1.10",
.ShouldEqual(ReleaseNotesHelper.ReleaseNotes.New("1.1.10", "1.1.10", null,
new[] {"Support for heterogeneous XML attributes.", "Make CsvFile re-entrant."}.ToFSharpList()));

It should_throws_on_empty_seq_input =
Expand Down Expand Up @@ -215,6 +217,7 @@ public class when_parsing_all_release_notes

static readonly ReleaseNotesHelper.ReleaseNotes expected = ReleaseNotesHelper.ReleaseNotes.New("1.1.10",
"1.1.10",
new Microsoft.FSharp.Core.FSharpOption<DateTime>(new DateTime(2013, 09, 12)),
new[]
{
"Support for heterogeneous XML attributes.",
Expand All @@ -226,6 +229,7 @@ public class when_parsing_all_release_notes
.ToFSharpList());

static readonly ReleaseNotesHelper.ReleaseNotes expected2 = ReleaseNotesHelper.ReleaseNotes.New("1.1.9", "1.1.9",
new Microsoft.FSharp.Core.FSharpOption<DateTime>(new DateTime(2013, 07, 21)),
new[] {"Infer booleans for ints that only manifest 0 and 1."}
.ToFSharpList());

Expand All @@ -249,6 +253,7 @@ public class when_parsing_octokit_release_notes


static readonly ReleaseNotesHelper.ReleaseNotes expected = ReleaseNotesHelper.ReleaseNotes.New("0.1.3", "0.1.3",
new Microsoft.FSharp.Core.FSharpOption<DateTime>(new DateTime(2013, 11, 5)),
new[]
{
"New Xamarin Component store versions of Octokit.net",
Expand All @@ -275,6 +280,7 @@ public class when_parsing_machine_release_notes


static readonly ReleaseNotesHelper.ReleaseNotes expected = ReleaseNotesHelper.ReleaseNotes.New("1.8.0", "1.8.0",
null,
new[]
{
"When the subject's constructor throws an exception, it is now bubbled up and shown in the failure message.",
Expand Down Expand Up @@ -303,6 +309,7 @@ public class when_parsing_semver_release_notes
static readonly ReleaseNotesHelper.ReleaseNotes expected =
ReleaseNotesHelper.ReleaseNotes.New("1.0.0",
"1.0.0-rc.1",
new Microsoft.FSharp.Core.FSharpOption<DateTime>(new DateTime(2013, 10, 30)),
new[]
{
"Initial release"
Expand All @@ -312,6 +319,7 @@ public class when_parsing_semver_release_notes
static readonly ReleaseNotesHelper.ReleaseNotes expected2 =
ReleaseNotesHelper.ReleaseNotes.New("1.0.0",
"1.0.0-beta.2",
null,
new[]
{
"Fixed problems with Microsoft.Threading.Tasks"
Expand Down

0 comments on commit 43de5cf

Please sign in to comment.