From b4df103f7861707a10fa2275823307d8f70bc784 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 14 May 2018 11:17:23 +0200 Subject: pkg/git: add PreviousReleaseTags PreviousReleaseTags returns list of preceding release tags that are reachable from the given commit. Update #501 --- pkg/git/git_test.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'pkg/git/git_test.go') diff --git a/pkg/git/git_test.go b/pkg/git/git_test.go index 18ba03d6e..66159107f 100644 --- a/pkg/git/git_test.go +++ b/pkg/git/git_test.go @@ -82,6 +82,51 @@ func testPredicate(t *testing.T, fn func(string) bool, tests map[string]bool) { } } +func TestParseReleaseTags(t *testing.T) { + input := ` +v3.1 +v2.6.12 +v2.6.39 +v3.0 +v3.10 +v2.6.13 +v3.11 +v3.19 +v3.9 +v3.2 +v4.9 +v2.6.32 +v4.0 +voo +v1.foo +v10.2.foo +v1.2. +v1. +` + want := []string{ + "v4.9", + "v4.0", + "v3.19", + "v3.11", + "v3.10", + "v3.9", + "v3.2", + "v3.1", + "v3.0", + "v2.6.39", + "v2.6.32", + "v2.6.13", + "v2.6.12", + } + got, err := parseReleaseTags([]byte(input)) + if err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(got, want) { + t.Fatalf("got bad tags\ngot: %+v\nwant: %+v", got, want) + } +} + func TestExtractFixTags(t *testing.T) { commits, err := extractFixTags(strings.NewReader(extractFixTagsInput), extractFixTagsEmail) if err != nil { -- cgit mrf-deployment