Skip to content

Commit

Permalink
add test for unexported constant with duplicate value
Browse files Browse the repository at this point in the history
  • Loading branch information
nishanths committed Nov 12, 2021
1 parent 8eb1db0 commit f730889
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
19 changes: 18 additions & 1 deletion testdata/src/duplicate-enum-value/duplicate_enum_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@ const (
TamilNadu
Kerala
Karnataka
DefaultState = TamilNadu
)

const DefaultState = TamilNadu
type Chart int // want Chart:"^Line,Area,Sunburst,Pie,circle$"

const (
Line Chart = iota
Area
Sunburst
Pie
circle = Pie // NOTE: unexported
)

func _s(c Chart) {
switch c { // want "^missing cases in switch of type Chart: Pie\\|circle$"
case Line:
case Sunburst:
case Area:
}
}
8 changes: 8 additions & 0 deletions testdata/src/duplicate-enum-value/otherpkg/otherpkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@ func _r() {
case d.Karnataka:
}
}

func _s(c d.Chart) {
switch c { // want "^missing cases in switch of type duplicateenumvalue.Chart: Pie$"
case d.Line:
case d.Sunburst:
case d.Area:
}
}

0 comments on commit f730889

Please sign in to comment.