@@ -260,6 +260,7 @@ index ea874f5..ba38f84 100644
260
260
261
261
// Note: module here should be moduyle+version because this is checking the go module path on disk
262
262
checkModule := func (ctx context.Context , gwc gwclient.Client , module string , spec * dalec.Spec ) {
263
+ t .Helper ()
263
264
res , err := gwc .Solve (ctx , newSolveRequest (withBuildTarget ("debug/gomods" ), withSpec (ctx , t , spec )))
264
265
if err != nil {
265
266
t .Fatal (err )
@@ -314,24 +315,49 @@ index ea874f5..ba38f84 100644
314
315
})
315
316
316
317
t .Run ("with patch" , func (t * testing.T ) {
317
- t .Parallel ()
318
- testEnv .RunTest (baseCtx , t , func (ctx context.Context , gwc gwclient.Client ) {
319
- spec := baseSpec ()
318
+ t .Run ("file" , func (t * testing.T ) {
319
+ t .Parallel ()
320
+ testEnv .RunTest (baseCtx , t , func (ctx context.Context , gwc gwclient.Client ) {
321
+ spec := baseSpec ()
320
322
321
- patchName := "patch"
322
- spec .Sources [patchName ] = dalec.Source {
323
- Inline : & dalec.SourceInline {
324
- File : & dalec.SourceInlineFile {
325
- Contents : downgradePatch ,
323
+ patchName := "patch"
324
+ spec .Sources [patchName ] = dalec.Source {
325
+ Inline : & dalec.SourceInline {
326
+ File : & dalec.SourceInlineFile {
327
+ Contents : downgradePatch ,
328
+ },
326
329
},
327
- },
328
- }
330
+ }
329
331
330
- spec .Patches = map [string ][]dalec.PatchSpec {
331
- srcName : {{Source : patchName }},
332
- }
332
+ spec .Patches = map [string ][]dalec.PatchSpec {
333
+ srcName : {{Source : patchName }},
334
+ }
333
335
334
- checkModule (
ctx ,
gwc ,
"github.com/cpuguy83/[email protected] " ,
spec )
336
+ checkModule (
ctx ,
gwc ,
"github.com/cpuguy83/[email protected] " ,
spec )
337
+ })
338
+ })
339
+ t .Run ("dir" , func (t * testing.T ) {
340
+ t .Parallel ()
341
+ testEnv .RunTest (baseCtx , t , func (ctx context.Context , gwc gwclient.Client ) {
342
+ spec := baseSpec ()
343
+
344
+ patchName := "patch"
345
+ spec .Sources [patchName ] = dalec.Source {
346
+ Inline : & dalec.SourceInline {
347
+ Dir : & dalec.SourceInlineDir {
348
+ Files : map [string ]* dalec.SourceInlineFile {
349
+ "patch-file" : {Contents : downgradePatch },
350
+ },
351
+ },
352
+ },
353
+ }
354
+
355
+ spec .Patches = map [string ][]dalec.PatchSpec {
356
+ srcName : {{Source : patchName , Path : "patch-file" }},
357
+ }
358
+
359
+ checkModule (
ctx ,
gwc ,
"github.com/cpuguy83/[email protected] " ,
spec )
360
+ })
335
361
})
336
362
})
337
363
}
0 commit comments