Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/token_supply_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ func (tokenSupplyType TokenSupplyType) String() string {
return "TOKEN_SUPPLY_TYPE_FINITE"
}

panic(fmt.Sprintf("unreachable: TokenType.String() switch statement is non-exhaustive. Status: %v", uint32(tokenSupplyType)))
panic(fmt.Sprintf("unreachable: TokenSupplyType.String() switch statement is non-exhaustive. Status: %v", uint32(tokenSupplyType)))
}
41 changes: 41 additions & 0 deletions sdk/token_supply_type_unit_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package hiero

// SPDX-License-Identifier: Apache-2.0

import (
"github.com/stretchr/testify/assert"
"testing"
)

func TestUnitTokenSupplyTypeString(t *testing.T) {
t.Parallel()

tests := []struct {
name string
tst TokenSupplyType
want string
}{
{name: "Infinite", tst: TokenSupplyTypeInfinite, want: "TOKEN_SUPPLY_TYPE_INFINITE"},
{name: "Finite", tst: TokenSupplyTypeFinite, want: "TOKEN_SUPPLY_TYPE_FINITE"},
}

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
assert.Equal(t, test.want, test.tst.String(), "TokenSupplyType(%d).String()", test.tst)
})
}
}

func TestUnitTokenSupplyTypeStringPanic(t *testing.T) {
t.Parallel()

var unknownSupplyType TokenSupplyType = 100
assert.PanicsWithValue(
t,
"unreachable: TokenSupplyType.String() switch statement is non-exhaustive. Status: 100",
func() {
_ = unknownSupplyType.String()
},
)
}
Loading