func BenchmarkGetStability(b *testing.B) { for i := 0; i < b.N; i++ { for _, tCase := range ttc { packages.GetStability(tCase.Version) } for _, tCase := range btc { packages.GetStability(tCase.Version) } } }
func (git *Git) prepareBranches() error { cmd := exec.Command("git", "branch", "--no-color", "--no-abbrev", "-v") cmd.Dir = git.RepoDir out, err := cmd.CombinedOutput() if err != nil { return fmt.Errorf("git branches --no-color --no-abbrev -v. %s", err) } for _, branch := range strings.SplitAfter(string(out), "\n") { response := pbRegExp.FindStringSubmatch(branch) if response != nil { git.Version = packages.PrepareBranchVersion(response[1]) git.VersionNormalized = packages.VersionNormalizedBranch(response[1]) git.Reference = response[2] 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 (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 TestBranchVersion(t *testing.T) { for _, tc := range btc { v := packages.PrepareBranchVersion(tc.Branch) if v != tc.Version { t.Fatalf("PrepareBranchVersion: %s != %s", v, tc.Version) } vn := packages.VersionNormalizedBranch(tc.Branch) if vn != tc.VersionNormalized { t.Fatalf("VersionNormalizedBranch: %s != %s", vn, tc.VersionNormalized) } s := packages.GetStability(tc.Version) if s != tc.Stability { t.Fatalf("GetStability: %s != %s", s, tc.Stability) } } }
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) } } }