learn-go-with-tests/pointererror/pointererror_test.go

23 lines
315 B
Go
Raw Normal View History

2025-02-02 02:18:14 +00:00
package pointererror
import (
"fmt"
"testing"
)
func TestWallet(t *testing.T) {
wallet := Wallet{}
wallet.Deposit(Bitcoin(10))
got := wallet.Balance()
fmt.Printf("address of balance in test is %p \n", &wallet.balance)
want := Bitcoin(10)
if got != want {
t.Errorf("got %s want %s", got, want)
}
}