(t *testing.T)
| 578 | } |
| 579 | |
| 580 | func TestFindMaxCommonVersion(t *testing.T) { |
| 581 | cases := []struct { |
| 582 | name string |
| 583 | givePlugin []int |
| 584 | giveCLI []int |
| 585 | want int |
| 586 | }{ |
| 587 | {name: "support_less", givePlugin: []int{1, 2, 3}, giveCLI: []int{1, 2}, want: 2}, |
| 588 | {name: "support_same", givePlugin: []int{1, 2, 3}, giveCLI: []int{1, 2, 3}, want: 3}, |
| 589 | {name: "support_more", givePlugin: []int{1, 2, 3}, giveCLI: []int{2, 3, 4}, want: 3}, |
| 590 | {name: "support_only_lower", givePlugin: []int{3, 4, 5}, giveCLI: []int{6, 7}, want: -1}, |
| 591 | {name: "support_only_higher", givePlugin: []int{3, 4, 5}, giveCLI: []int{1, 2}, want: -2}, |
| 592 | } |
| 593 | for _, tc := range cases { |
| 594 | t.Run(tc.name, func(t *testing.T) { |
| 595 | got := findMaxCommonVersion(tc.givePlugin, tc.giveCLI) |
| 596 | assert.Equal(t, tc.want, got) |
| 597 | }) |
| 598 | } |
| 599 | } |
| 600 | |
| 601 | func TestSync_IsolatedPluginEnvironmentsInCloud(t *testing.T) { |
| 602 | configs := []struct { |
nothing calls this directly
no test coverage detected