@@ -24,15 +24,11 @@ import (
2424
2525func TestToSidekickConfig (t * testing.T ) {
2626 for _ , test := range []struct {
27- name string
28- library * config.Library
29- channel * config.Channel
30- googleapisDir string
31- discoveryDir string
32- protobufDir string
33- conformanceDir string
34- showcaseDir string
35- want * sidekickconfig.Config
27+ name string
28+ library * config.Library
29+ channel * config.Channel
30+ sources * Sources
31+ want * sidekickconfig.Config
3632 }{
3733 {
3834 name : "minimal config" ,
@@ -43,7 +39,9 @@ func TestToSidekickConfig(t *testing.T) {
4339 Path : "google/cloud/storage/v1" ,
4440 ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
4541 },
46- googleapisDir : "/tmp/googleapis" ,
42+ sources : & Sources {
43+ Googleapis : "/tmp/googleapis" ,
44+ },
4745 want : & sidekickconfig.Config {
4846 General : sidekickconfig.GeneralConfig {
4947 Language : "rust" ,
@@ -72,7 +70,9 @@ func TestToSidekickConfig(t *testing.T) {
7270 Path : "google/cloud/storage/v1" ,
7371 ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
7472 },
75- googleapisDir : "/tmp/googleapis" ,
73+ sources : & Sources {
74+ Googleapis : "/tmp/googleapis" ,
75+ },
7676 want : & sidekickconfig.Config {
7777 General : sidekickconfig.GeneralConfig {
7878 Language : "rust" ,
@@ -102,7 +102,9 @@ func TestToSidekickConfig(t *testing.T) {
102102 Path : "google/cloud/storage/v1" ,
103103 ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
104104 },
105- googleapisDir : "/tmp/googleapis" ,
105+ sources : & Sources {
106+ Googleapis : "/tmp/googleapis" ,
107+ },
106108 want : & sidekickconfig.Config {
107109 General : sidekickconfig.GeneralConfig {
108110 Language : "rust" ,
@@ -146,7 +148,9 @@ func TestToSidekickConfig(t *testing.T) {
146148 Path : "google/cloud/storage/v1" ,
147149 ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
148150 },
149- googleapisDir : "/tmp/googleapis" ,
151+ sources : & Sources {
152+ Googleapis : "/tmp/googleapis" ,
153+ },
150154 want : & sidekickconfig.Config {
151155 General : sidekickconfig.GeneralConfig {
152156 Language : "rust" ,
@@ -188,7 +192,9 @@ func TestToSidekickConfig(t *testing.T) {
188192 Path : "google/cloud/storage/v1" ,
189193 ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
190194 },
191- googleapisDir : "/tmp/googleapis" ,
195+ sources : & Sources {
196+ Googleapis : "/tmp/googleapis" ,
197+ },
192198 want : & sidekickconfig.Config {
193199 General : sidekickconfig.GeneralConfig {
194200 Language : "rust" ,
@@ -229,7 +235,9 @@ func TestToSidekickConfig(t *testing.T) {
229235 Path : "google/cloud/storage/v1" ,
230236 ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
231237 },
232- googleapisDir : "/tmp/googleapis" ,
238+ sources : & Sources {
239+ Googleapis : "/tmp/googleapis" ,
240+ },
233241 want : & sidekickconfig.Config {
234242 General : sidekickconfig.GeneralConfig {
235243 Language : "rust" ,
@@ -265,11 +273,9 @@ func TestToSidekickConfig(t *testing.T) {
265273 Path : "google/cloud/storage/v1" ,
266274 ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
267275 },
268- googleapisDir : "/tmp/googleapis" ,
269- discoveryDir : "" ,
270- protobufDir : "" ,
271- conformanceDir : "" ,
272- showcaseDir : "" ,
276+ sources : & Sources {
277+ Googleapis : "/tmp/googleapis" ,
278+ },
273279 want : & sidekickconfig.Config {
274280 General : sidekickconfig.GeneralConfig {
275281 Language : "rust" ,
@@ -324,11 +330,9 @@ func TestToSidekickConfig(t *testing.T) {
324330 Path : "google/cloud/storage/v1" ,
325331 ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
326332 },
327- googleapisDir : "/tmp/googleapis" ,
328- discoveryDir : "" ,
329- protobufDir : "" ,
330- conformanceDir : "" ,
331- showcaseDir : "" ,
333+ sources : & Sources {
334+ Googleapis : "/tmp/googleapis" ,
335+ },
332336 want : & sidekickconfig.Config {
333337 General : sidekickconfig.GeneralConfig {
334338 Language : "rust" ,
@@ -374,11 +378,9 @@ func TestToSidekickConfig(t *testing.T) {
374378 Path : "google/cloud/storage/v1" ,
375379 ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
376380 },
377- googleapisDir : "/tmp/googleapis" ,
378- discoveryDir : "" ,
379- protobufDir : "" ,
380- conformanceDir : "" ,
381- showcaseDir : "" ,
381+ sources : & Sources {
382+ Googleapis : "/tmp/googleapis" ,
383+ },
382384 want : & sidekickconfig.Config {
383385 General : sidekickconfig.GeneralConfig {
384386 Language : "rust" ,
@@ -412,8 +414,10 @@ func TestToSidekickConfig(t *testing.T) {
412414 Path : "discoveries/compute.v1.json" ,
413415 ServiceConfig : "google/cloud/compute/v1/compute_v1.yaml" ,
414416 },
415- googleapisDir : "/tmp/googleapis" ,
416- discoveryDir : "/tmp/discovery-artifact-manager" ,
417+ sources : & Sources {
418+ Googleapis : "/tmp/googleapis" ,
419+ Discovery : "/tmp/discovery-artifact-manager" ,
420+ },
417421 want : & sidekickconfig.Config {
418422 General : sidekickconfig.GeneralConfig {
419423 Language : "rust" ,
@@ -442,9 +446,11 @@ func TestToSidekickConfig(t *testing.T) {
442446 Path : "discoveries/compute.v1.json" ,
443447 ServiceConfig : "google/cloud/compute/v1/compute_v1.yaml" ,
444448 },
445- googleapisDir : "/tmp/googleapis" ,
446- discoveryDir : "/tmp/discovery-artifact-manager" ,
447- showcaseDir : "/tmp/showcase" ,
449+ sources : & Sources {
450+ Googleapis : "/tmp/googleapis" ,
451+ Discovery : "/tmp/discovery-artifact-manager" ,
452+ Showcase : "/tmp/showcase" ,
453+ },
448454 want : & sidekickconfig.Config {
449455 General : sidekickconfig.GeneralConfig {
450456 Language : "rust" ,
@@ -474,7 +480,9 @@ func TestToSidekickConfig(t *testing.T) {
474480 channel : & config.Channel {
475481 Path : "google/apps/script/type/gmail" ,
476482 },
477- googleapisDir : "/tmp/googleapis" ,
483+ sources : & Sources {
484+ Googleapis : "/tmp/googleapis" ,
485+ },
478486 want : & sidekickconfig.Config {
479487 General : sidekickconfig.GeneralConfig {
480488 Language : "rust" ,
@@ -501,7 +509,9 @@ func TestToSidekickConfig(t *testing.T) {
501509 Path : "google/longrunning" ,
502510 ServiceConfig : "google/longrunning/longrunning.yaml" ,
503511 },
504- googleapisDir : "/tmp/googleapis" ,
512+ sources : & Sources {
513+ Googleapis : "/tmp/googleapis" ,
514+ },
505515 want : & sidekickconfig.Config {
506516 General : sidekickconfig.GeneralConfig {
507517 Language : "rust" ,
@@ -535,7 +545,9 @@ func TestToSidekickConfig(t *testing.T) {
535545 Path : "google/spanner/admin/database/v1" ,
536546 ServiceConfig : "google/spanner/admin/database/v1/spanner.yaml" ,
537547 },
538- googleapisDir : "/tmp/googleapis" ,
548+ sources : & Sources {
549+ Googleapis : "/tmp/googleapis" ,
550+ },
539551 want : & sidekickconfig.Config {
540552 General : sidekickconfig.GeneralConfig {
541553 Language : "rust" ,
@@ -565,7 +577,9 @@ func TestToSidekickConfig(t *testing.T) {
565577 Path : "google/cloud/storageinsights/v1" ,
566578 ServiceConfig : "google/cloud/storageinsights/v1/storageinsights_v1.yaml" ,
567579 },
568- googleapisDir : "/tmp/googleapis" ,
580+ sources : & Sources {
581+ Googleapis : "/tmp/googleapis" ,
582+ },
569583 want : & sidekickconfig.Config {
570584 General : sidekickconfig.GeneralConfig {
571585 Language : "rust" ,
@@ -613,8 +627,10 @@ func TestToSidekickConfig(t *testing.T) {
613627 Path : "discoveries/compute.v1.json" ,
614628 ServiceConfig : "google/cloud/compute/v1/compute_v1.yaml" ,
615629 },
616- googleapisDir : "/tmp/googleapis" ,
617- discoveryDir : "/tmp/discovery-artifact-manager" ,
630+ sources : & Sources {
631+ Googleapis : "/tmp/googleapis" ,
632+ Discovery : "/tmp/discovery-artifact-manager" ,
633+ },
618634 want : & sidekickconfig.Config {
619635 General : sidekickconfig.GeneralConfig {
620636 Language : "rust" ,
@@ -659,9 +675,11 @@ func TestToSidekickConfig(t *testing.T) {
659675 Path : "google/cloud/vision/v1" ,
660676 ServiceConfig : "google/cloud/vision/v1/vision_v1.yaml" ,
661677 },
662- googleapisDir : "/tmp/googleapis" ,
663- protobufDir : "/tmp/protobuf/src" ,
664- conformanceDir : "/tmp/conformance" ,
678+ sources : & Sources {
679+ Googleapis : "/tmp/googleapis" ,
680+ ProtobufSrc : "/tmp/protobuf/src" ,
681+ Conformance : "/tmp/conformance" ,
682+ },
665683 want : & sidekickconfig.Config {
666684 General : sidekickconfig.GeneralConfig {
667685 Language : "rust" ,
@@ -690,7 +708,9 @@ func TestToSidekickConfig(t *testing.T) {
690708 Path : "google/showcase/v1beta1" ,
691709 ServiceConfig : "google/showcase/v1beta1/showcase_v1beta1.yaml" ,
692710 },
693- showcaseDir : "/tmp/gapic-showcase" ,
711+ sources : & Sources {
712+ Showcase : "/tmp/gapic-showcase" ,
713+ },
694714 want : & sidekickconfig.Config {
695715 General : sidekickconfig.GeneralConfig {
696716 Language : "rust" ,
@@ -719,6 +739,7 @@ func TestToSidekickConfig(t *testing.T) {
719739 },
720740 },
721741 },
742+ sources : & Sources {},
722743 want : & sidekickconfig.Config {
723744 General : sidekickconfig.GeneralConfig {
724745 Language : "rust_storage" ,
@@ -738,6 +759,7 @@ func TestToSidekickConfig(t *testing.T) {
738759 },
739760 },
740761 },
762+ sources : & Sources {},
741763 want : & sidekickconfig.Config {
742764 General : sidekickconfig.GeneralConfig {
743765 Language : "rust" ,
@@ -757,6 +779,7 @@ func TestToSidekickConfig(t *testing.T) {
757779 },
758780 },
759781 },
782+ sources : & Sources {},
760783 want : & sidekickconfig.Config {
761784 General : sidekickconfig.GeneralConfig {
762785 Language : "rust+prost" ,
@@ -768,14 +791,14 @@ func TestToSidekickConfig(t *testing.T) {
768791 if test .library .Rust != nil && test .library .Rust .Modules != nil {
769792 var commentOverrides []sidekickconfig.DocumentationOverride
770793 for _ , module := range test .library .Rust .Modules {
771- got := moduleToSidekickConfig (test .library , module , test .googleapisDir , test . protobufDir )
794+ got := moduleToSidekickConfig (test .library , module , test .sources )
772795 commentOverrides = append (commentOverrides , got .CommentOverrides ... )
773796 }
774797 if diff := cmp .Diff (test .want .CommentOverrides , commentOverrides ); diff != "" {
775798 t .Errorf ("mismatch (-want +got):\n %s" , diff )
776799 }
777800 } else {
778- got := toSidekickConfig (test .library , test .channel , test .googleapisDir , test . discoveryDir , test . protobufDir , test . conformanceDir , test . showcaseDir )
801+ got := toSidekickConfig (test .library , test .channel , test .sources )
779802 if diff := cmp .Diff (test .want , got ); diff != "" {
780803 t .Errorf ("mismatch (-want +got):\n %s" , diff )
781804 }
0 commit comments