func BenchmarkPrepareTagVersionNormalized(b *testing.B) { for i := 0; i < b.N; i++ { for _, tCase := range ttc { packages.PrepareTagVersionNormalized(tCase.NewNormalized) } } }
func (git *Git) prepareTags() error { cmd := exec.Command("git", "show-ref", "--tags") cmd.Dir = git.RepoDir // Don't need check error out, _ := cmd.CombinedOutput() for _, tag := range strings.SplitAfter(string(out), "\n") { response := ptRegExp.FindStringSubmatch(tag) if response != nil { git.Version = packages.PrepareTagVersion(response[2]) newVersion := packages.VersionNormalizedTag(response[2]) git.VersionNormalized = packages.PrepareTagVersionNormalized(newVersion) git.Reference = response[1] p, err := git.getComposerInformation() if err != nil { return err } stability := packages.GetStability(git.Version) if stability != "dev" { p.Stability = true } git.Packages[git.Version] = p } } return nil }
func TestTagVersion(t *testing.T) { for _, tc := range ttc { v := packages.PrepareTagVersion(tc.Tag) if v != tc.Version { t.Fatalf("PrepareTagVersion: %s != %s", v, tc.Version) } nv := packages.VersionNormalizedTag(tc.Tag) if nv != tc.NewNormalized { t.Fatalf("VersionNormalizedTag: %s != %s", nv, tc.NewNormalized) } vn := packages.PrepareTagVersionNormalized(tc.NewNormalized) if vn != tc.VersionNormalized { t.Fatalf("PrepareTagVersionNormalized: %s != %s", vn, tc.VersionNormalized) } s := packages.GetStability(tc.Version) if s != tc.Stability { t.Fatalf("GetStability: %s != %s", s, tc.Stability) } } }