(t *testing.T)
| 503 | } |
| 504 | |
| 505 | func TestNoProtoFilesError(t *testing.T) { |
| 506 | t.Parallel() |
| 507 | |
| 508 | ctx := t.Context() |
| 509 | |
| 510 | moduleSet, err := bufmoduletesting.NewOmniProvider( |
| 511 | bufmoduletesting.ModuleData{ |
| 512 | Name: "buf.build/foo/a", |
| 513 | PathToData: map[string][]byte{ |
| 514 | "a.proto": []byte( |
| 515 | `syntax = proto3; package a;`, |
| 516 | ), |
| 517 | }, |
| 518 | }, |
| 519 | bufmoduletesting.ModuleData{ |
| 520 | Name: "buf.build/foo/b", |
| 521 | PathToData: map[string][]byte{ |
| 522 | "LICENSE": []byte( |
| 523 | "fake license", |
| 524 | ), |
| 525 | }, |
| 526 | }, |
| 527 | ) |
| 528 | require.NoError(t, err) |
| 529 | |
| 530 | moduleA := moduleSet.GetModuleForOpaqueID("buf.build/foo/a") |
| 531 | require.NotNil(t, moduleA) |
| 532 | |
| 533 | checkError := func(err error) { |
| 534 | require.Error(t, err) |
| 535 | noProtoFilesError := &bufmodule.NoProtoFilesError{} |
| 536 | require.True(t, errors.As(err, &noProtoFilesError), err.Error()) |
| 537 | require.Contains( |
| 538 | t, |
| 539 | "buf.build/foo/b", |
| 540 | noProtoFilesError.ModuleDescription, |
| 541 | ) |
| 542 | } |
| 543 | moduleReadBucket := bufmodule.ModuleSetToModuleReadBucketWithOnlyProtoFiles(moduleSet) |
| 544 | err = moduleReadBucket.WalkFileInfos(ctx, func(bufmodule.FileInfo) error { return nil }) |
| 545 | checkError(err) |
| 546 | } |
| 547 | |
| 548 | func TestProtoFileTargetPath(t *testing.T) { |
| 549 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…