diff --git a/wallet/wallet_test.go b/wallet/wallet_test.go index 5c1e012..77f6c97 100644 --- a/wallet/wallet_test.go +++ b/wallet/wallet_test.go @@ -1,6 +1,25 @@ package wallet -import "testing" +import ( + "fmt" + "testing" +) + +func ExampleWallet() { + wallet := Wallet{10} + + wallet.Deposit(10) + fmt.Printf("The balance is %s\n", wallet.Balance()) + + err := wallet.Withdraw(10) + if err != nil { + fmt.Println(err) + } + fmt.Printf("The balance is %s\n", wallet.Balance()) + + // Output: The balance is 20 BTC + // The balance is 10 BTC +} func TestWallet(t *testing.T) { t.Run("deposit", func(t *testing.T) {