We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1a483ac commit 31c1593Copy full SHA for 31c1593
pointers-and-errors/bitcoin-and-wallet_test.go
@@ -25,6 +25,12 @@ func TestWallet(t *testing.T) {
25
}
26
27
28
+ assertNoError := func(t testing.TB, got error) {
29
+ t.Helper()
30
+ if got != nil {
31
+ t.Fatal("got an error but didn't want one")
32
+ }
33
34
t.Run("deposit", func(t *testing.T) {
35
wallet := Wallet{}
36
@@ -36,8 +42,9 @@ func TestWallet(t *testing.T) {
42
t.Run("withdraw", func(t *testing.T) {
37
43
wallet := Wallet{balance: Bitcoin(20)}
38
44
39
- wallet.Withdraw(Bitcoin(10))
45
+ err := wallet.Withdraw(Bitcoin(10))
40
46
want := Bitcoin(10)
47
+ assertNoError(t, err)
41
48
assertBalance(t, wallet, want)
49
})
50
0 commit comments