MCPcopy
hub / github.com/Jguer/yay / TestIntegrationCleanAUR

Function TestIntegrationCleanAUR

clean_test.go:120–216  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

118}
119
120func TestIntegrationCleanAUR(t *testing.T) {
121 buildDir := filepath.Join(t.TempDir(), "build")
122 yayGitDir := filepath.Join(buildDir, "yay-git")
123 zoomDir := filepath.Join(buildDir, "zoom")
124
125 t.Parallel()
126
127 testCases := []struct {
128 name string
129 args []string
130 wantDirs []string
131 }{
132 {
133 name: "Sync clean AUR",
134 args: []string{"S", "c", "a"},
135 wantDirs: []string{"zoom"},
136 },
137 {
138 name: "Sync clean double AUR",
139 args: []string{"S", "c", "c", "a"},
140 wantDirs: []string{},
141 },
142 }
143
144 dbExc := &mock.DBExecutor{
145 PackageOptionalDependsFn: func(i alpm.Package) []alpm.Depend {
146 if i.Name() == "linux" {
147 return []alpm.Depend{
148 {
149 Name: "linux-headers",
150 },
151 }
152 }
153
154 return []alpm.Depend{}
155 },
156 PackageProvidesFn: func(p alpm.Package) []alpm.Depend { return []alpm.Depend{} },
157 PackageDependsFn: func(p alpm.Package) []alpm.Depend { return []alpm.Depend{} },
158 InstalledRemotePackagesFn: func() map[string]alpm.Package {
159 return map[string]alpm.Package{
160 "zoom": &mock.Package{
161 PName: "zoom",
162 PVersion: "6.5.8-1",
163 PBase: "zoom",
164 PReason: alpm.PkgReasonExplicit,
165 },
166 }
167 },
168 }
169
170 for _, tc := range testCases {
171 t.Run(tc.name, func(t *testing.T) {
172 mockRunner := &exe.MockRunner{}
173
174 cfg := &settings.Configuration{
175 BuildDir: buildDir,
176 Mode: parser.ModeAUR,
177 }

Callers

nothing calls this directly

Calls 7

MakeArgumentsFunction · 0.92
AddArgMethod · 0.80
handleCmdFunction · 0.70
LenMethod · 0.65
newTestLoggerFunction · 0.50
NameMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected