diff --git a/wallet/wallet.go b/wallet/wallet.go index 2a4893a..f2fb957 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -1,7 +1,13 @@ package wallet +import "fmt" + type Bitcoin int +func (b Bitcoin) String() string { + return fmt.Sprintf("%d BTC", b) +} + type Wallet struct { balance Bitcoin } diff --git a/wallet/wallet_test.go b/wallet/wallet_test.go index 6c6179a..c575ec9 100644 --- a/wallet/wallet_test.go +++ b/wallet/wallet_test.go @@ -11,6 +11,6 @@ func TestWallet(t *testing.T) { want := Bitcoin(10) if got != want { - t.Errorf("got %d want %d", got, want) + t.Errorf("got %q want %q", got, want) } }