regenerate testData

This commit is contained in:
sean 2023-04-10 21:37:44 +02:00
parent f6e6ea6814
commit 89156fba2c
17 changed files with 125 additions and 50 deletions

11
testdata/day.golden vendored
View File

@ -5,11 +5,16 @@ var _DayIndex = [...]uint8{0, 6, 13, 22, 30, 36, 44, 50}
const _DayLowerName = "mondaytuesdaywednesdaythursdayfridaysaturdaysunday"
func (i Day) String() string {
func (i Day) string() (string, error) {
if i < 0 || i >= Day(len(_DayIndex)-1) {
return fmt.Sprintf("Day(%d)", i)
return "", fmt.Errorf("value is out of enum range")
}
return _DayName[_DayIndex[i]:_DayIndex[i+1]]
return _DayName[_DayIndex[i]:_DayIndex[i+1]], nil
}
func (i Day) String() string {
val, _ := i.string()
return val
}
func (Day) Values() []string {

View File

@ -5,11 +5,16 @@ var _DayIndex = [...]uint8{0, 11, 23, 37, 50, 61, 74, 85}
const _DayLowerName = "nightmondaynighttuesdaynightwednesdaynightthursdaynightfridaynightsaturdaynightsunday"
func (i Day) String() string {
func (i Day) string() (string, error) {
if i < 0 || i >= Day(len(_DayIndex)-1) {
return fmt.Sprintf("Day(%d)", i)
return "", fmt.Errorf("value is out of enum range")
}
return _DayName[_DayIndex[i]:_DayIndex[i+1]]
return _DayName[_DayIndex[i]:_DayIndex[i+1]], nil
}
func (i Day) String() string {
val, _ := i.string()
return val
}
// An "invalid array index" compiler error signifies that the constant values have changed.

View File

@ -5,11 +5,16 @@ var _DayIndex = [...]uint8{0, 5, 12, 21, 29, 36, 44, 50}
const _DayLowerName = "lunestuesdaywednesdaythursdayviernessaturdaysunday"
func (i Day) String() string {
func (i Day) string() (string, error) {
if i < 0 || i >= Day(len(_DayIndex)-1) {
return fmt.Sprintf("Day(%d)", i)
return "", fmt.Errorf("value is out of enum range")
}
return _DayName[_DayIndex[i]:_DayIndex[i+1]]
return _DayName[_DayIndex[i]:_DayIndex[i+1]], nil
}
func (i Day) String() string {
val, _ := i.string()
return val
}
// An "invalid array index" compiler error signifies that the constant values have changed.

View File

@ -5,11 +5,16 @@ var _DayIndex = [...]uint8{0, 9, 19, 31, 42, 51, 62, 71}
const _DayLowerName = "daymondaydaytuesdaydaywednesdaydaythursdaydayfridaydaysaturdaydaysunday"
func (i Day) String() string {
func (i Day) string() (string, error) {
if i < 0 || i >= Day(len(_DayIndex)-1) {
return fmt.Sprintf("Day(%d)", i)
return "", fmt.Errorf("value is out of enum range")
}
return _DayName[_DayIndex[i]:_DayIndex[i+1]]
return _DayName[_DayIndex[i]:_DayIndex[i+1]], nil
}
func (i Day) String() string {
val, _ := i.string()
return val
}
// An "invalid array index" compiler error signifies that the constant values have changed.

2
testdata/gap.golden vendored
View File

@ -25,7 +25,7 @@ func (i Gap) String() string {
case i == 11:
return _GapName_2
default:
return fmt.Sprintf("Gap(%d)", i)
return ""
}
}

11
testdata/num.golden vendored
View File

@ -5,12 +5,17 @@ var _NumIndex = [...]uint8{0, 3, 6, 8, 10, 12}
const _NumLowerName = "m_2m_1m0m1m2"
func (i Num) String() string {
func (i Num) string() (string, error) {
i -= -2
if i < 0 || i >= Num(len(_NumIndex)-1) {
return fmt.Sprintf("Num(%d)", i+-2)
return "", fmt.Errorf("value is out of enum range")
}
return _NumName[_NumIndex[i]:_NumIndex[i+1]]
return _NumName[_NumIndex[i]:_NumIndex[i+1]], nil
}
func (i Num) String() string {
val, _ := i.string()
return val
}
func (Num) Values() []string {

View File

@ -5,12 +5,17 @@ var _NumberIndex = [...]uint8{0, 3, 6, 11}
const _NumberLowerName = "onetwothree"
func (i Number) String() string {
func (i Number) string() (string, error) {
i -= 1
if i < 0 || i >= Number(len(_NumberIndex)-1) {
return fmt.Sprintf("Number(%d)", i+1)
return "", fmt.Errorf("value is out of enum range")
}
return _NumberName[_NumberIndex[i]:_NumberIndex[i+1]]
return _NumberName[_NumberIndex[i]:_NumberIndex[i+1]], nil
}
func (i Number) String() string {
val, _ := i.string()
return val
}
func (Number) Values() []string {

11
testdata/prime.golden vendored
View File

@ -18,11 +18,16 @@ var _PrimeMap = map[Prime]string{
43: _PrimeName[32:35],
}
func (i Prime) String() string {
func (i Prime) string() (string, error) {
if str, ok := _PrimeMap[i]; ok {
return str
return str, nil
}
return fmt.Sprintf("Prime(%d)", i)
return "", fmt.Errorf("value is out of enum range")
}
func (i Prime) String() string {
str, _ := i.string()
return str
}
func (Prime) Values() []string {

View File

@ -18,11 +18,16 @@ var _PrimeMap = map[Prime]string{
43: _PrimeName[32:35],
}
func (i Prime) String() string {
func (i Prime) string() (string, error) {
if str, ok := _PrimeMap[i]; ok {
return str
return str, nil
}
return fmt.Sprintf("Prime(%d)", i)
return "", fmt.Errorf("value is out of enum range")
}
func (i Prime) String() string {
str, _ := i.string()
return str
}
// An "invalid array index" compiler error signifies that the constant values have changed.

View File

@ -18,11 +18,16 @@ var _PrimeMap = map[Prime]string{
43: _PrimeName[32:35],
}
func (i Prime) String() string {
func (i Prime) string() (string, error) {
if str, ok := _PrimeMap[i]; ok {
return str
return str, nil
}
return fmt.Sprintf("Prime(%d)", i)
return "", fmt.Errorf("value is out of enum range")
}
func (i Prime) String() string {
str, _ := i.string()
return str
}
// An "invalid array index" compiler error signifies that the constant values have changed.

View File

@ -18,11 +18,16 @@ var _PrimeMap = map[Prime]string{
43: _PrimeName[32:35],
}
func (i Prime) String() string {
func (i Prime) string() (string, error) {
if str, ok := _PrimeMap[i]; ok {
return str
return str, nil
}
return fmt.Sprintf("Prime(%d)", i)
return "", fmt.Errorf("value is out of enum range")
}
func (i Prime) String() string {
str, _ := i.string()
return str
}
// An "invalid array index" compiler error signifies that the constant values have changed.
@ -140,7 +145,7 @@ func (i *Prime) UnmarshalJSON(data []byte) error {
}
func (i Prime) Value() (driver.Value, error) {
return i.String(), nil
return i.string()
}
func (i *Prime) Scan(value interface{}) error {

View File

@ -18,11 +18,16 @@ var _PrimeMap = map[Prime]string{
43: _PrimeName[32:35],
}
func (i Prime) String() string {
func (i Prime) string() (string, error) {
if str, ok := _PrimeMap[i]; ok {
return str
return str, nil
}
return fmt.Sprintf("Prime(%d)", i)
return "", fmt.Errorf("value is out of enum range")
}
func (i Prime) String() string {
str, _ := i.string()
return str
}
// An "invalid array index" compiler error signifies that the constant values have changed.
@ -123,7 +128,7 @@ func (i Prime) IsAPrime() bool {
}
func (i Prime) Value() (driver.Value, error) {
return i.String(), nil
return i.string()
}
func (i *Prime) Scan(value interface{}) error {

View File

@ -18,11 +18,16 @@ var _PrimeMap = map[Prime]string{
43: _PrimeName[32:35],
}
func (i Prime) String() string {
func (i Prime) string() (string, error) {
if str, ok := _PrimeMap[i]; ok {
return str
return str, nil
}
return fmt.Sprintf("Prime(%d)", i)
return "", fmt.Errorf("value is out of enum range")
}
func (i Prime) String() string {
str, _ := i.string()
return str
}
// An "invalid array index" compiler error signifies that the constant values have changed.

View File

@ -18,11 +18,16 @@ var _PrimeMap = map[Prime]string{
43: _PrimeName[32:35],
}
func (i Prime) String() string {
func (i Prime) string() (string, error) {
if str, ok := _PrimeMap[i]; ok {
return str
return str, nil
}
return fmt.Sprintf("Prime(%d)", i)
return "", fmt.Errorf("value is out of enum range")
}
func (i Prime) String() string {
str, _ := i.string()
return str
}
// An "invalid array index" compiler error signifies that the constant values have changed.
@ -124,7 +129,7 @@ func (i Prime) IsAPrime() bool {
// MarshalYAML implements a YAML Marshaler for Prime
func (i Prime) MarshalYAML() (interface{}, error) {
return i.String(), nil
return i.string()
}
// UnmarshalYAML implements a YAML Unmarshaler for Prime

View File

@ -5,11 +5,16 @@ var _DayIndex = [...]uint8{0, 6, 13, 22, 30, 36, 44, 50}
const _DayLowerName = "mondaytuesdaywednesdaythursdayfridaysaturdaysunday"
func (i Day) String() string {
func (i Day) string() (string, error) {
if i < 0 || i >= Day(len(_DayIndex)-1) {
return fmt.Sprintf("Day(%d)", i)
return "", fmt.Errorf("value is out of enum range")
}
return _DayName[_DayIndex[i]:_DayIndex[i+1]]
return _DayName[_DayIndex[i]:_DayIndex[i+1]], nil
}
func (i Day) String() string {
val, _ := i.string()
return val
}
// An "invalid array index" compiler error signifies that the constant values have changed.

View File

@ -5,11 +5,16 @@ var _DayIndex = [...]uint8{0, 6, 13, 22, 30, 36, 44, 50}
const _DayLowerName = "mondaytuesdaywednesdaythursdayfridaysaturdaysunday"
func (i Day) String() string {
func (i Day) string() (string, error) {
if i < 0 || i >= Day(len(_DayIndex)-1) {
return fmt.Sprintf("Day(%d)", i)
return "", fmt.Errorf("value is out of enum range")
}
return _DayName[_DayIndex[i]:_DayIndex[i+1]]
return _DayName[_DayIndex[i]:_DayIndex[i+1]], nil
}
func (i Day) String() string {
val, _ := i.string()
return val
}
// An "invalid array index" compiler error signifies that the constant values have changed.

View File

@ -19,7 +19,7 @@ func (i Unum) String() string {
i -= 253
return _UnumName_1[_UnumIndex_1[i]:_UnumIndex_1[i+1]]
default:
return fmt.Sprintf("Unum(%d)", i)
return ""
}
}