Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jazanne committed Feb 2, 2024
1 parent 8409198 commit da4233b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/extinctions/extinctions.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func CheckExtinctions(opts options.Options, builder *refs.ReferenceSummaryBuilder) error {
gha.StartLogGroup("Checking for extinctions...")
defer gha.EndLogGroup()
flagKeys := make([]string, 0, len(builder.RemovedFlagKeys()))
flagKeys := builder.RemovedFlagKeys()

matcher, err := search.GetMatcher(opts, flagKeys, nil)
if err != nil {
Expand Down
30 changes: 29 additions & 1 deletion internal/references/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/assert"
)

func TestBuilder(t *testing.T) {
func TestBuilder_Build(t *testing.T) {
ref := ReferenceSummaryBuilder{
flagsAdded: map[string][]string{
"flag1": {"alias1"},
Expand Down Expand Up @@ -35,3 +35,31 @@ func TestBuilder(t *testing.T) {
assert.Len(t, built.FlagsRemoved, 2)
assert.Len(t, built.ExtinctFlags, 1)
}

func TestBuilder_RemovedFlagKeys(t *testing.T) {
ref := ReferenceSummaryBuilder{
flagsAdded: map[string][]string{
"flag1": {"alias1"},
"flag2": {"alias2"},
},
flagsRemoved: map[string][]string{
"flag2": {},
"flag3": {"alias3"},
"flag4": {"alias4"},
},
flagsFoundAtHead: map[string]struct{}{
"flag3": {},
},
foundFlags: map[string]struct{}{
"flag1": {},
"flag2": {},
"flag3": {},
"flag4": {},
},
includeExtinctions: true,
}

keys := ref.RemovedFlagKeys()

assert.Len(t, keys, 3)
}

0 comments on commit da4233b

Please sign in to comment.