MCPcopy Create free account
hub / github.com/archlinux-de/pkgstats-cli / linesContainsPackageStatistic

Function linesContainsPackageStatistic

cmd/search_test.go:11–19  ·  view source on GitHub ↗
(t *testing.T, lines []string, packages []string)

Source from the content-addressed store, hash-verified

9)
10
11func linesContainsPackageStatistic(t *testing.T, lines []string, packages []string) {
12 t.Helper()
13 for _, e := range packages {
14 matcher := regexp.MustCompile(fmt.Sprintf(`^%s\s+\d+\.\d+$`, regexp.QuoteMeta(e)))
15 if !slices.ContainsFunc(lines, func(v string) bool { return matcher.MatchString(v) }) {
16 t.Errorf("Expected to find '%s' in %v", e, lines)
17 }
18 }
19}
20
21func TestSearchPackages(t *testing.T) {
22 output, err := pkgstats(t, []string{"search", "php"})

Callers 4

TestShowPackagesFunction · 0.85
TestShowSinglePackageFunction · 0.85
TestSearchPackagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected