Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: replace t.Log(); t.FailNow() with t.Fatal() #19849

Merged
merged 1 commit into from
Jul 18, 2019
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
24 changes: 8 additions & 16 deletions accounts/abi/abi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"bytes"
"encoding/hex"
"fmt"
"log"
"math/big"
"reflect"
"strings"
Expand Down Expand Up @@ -102,8 +101,7 @@ func TestReader(t *testing.T) {
func TestTestNumbers(t *testing.T) {
abi, err := JSON(strings.NewReader(jsondata2))
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}

if _, err := abi.Pack("balance"); err != nil {
Expand Down Expand Up @@ -140,8 +138,7 @@ func TestTestNumbers(t *testing.T) {
func TestTestString(t *testing.T) {
abi, err := JSON(strings.NewReader(jsondata2))
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}

if _, err := abi.Pack("string", "hello world"); err != nil {
Expand All @@ -152,8 +149,7 @@ func TestTestString(t *testing.T) {
func TestTestBool(t *testing.T) {
abi, err := JSON(strings.NewReader(jsondata2))
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}

if _, err := abi.Pack("bool", true); err != nil {
Expand All @@ -164,8 +160,7 @@ func TestTestBool(t *testing.T) {
func TestTestSlice(t *testing.T) {
abi, err := JSON(strings.NewReader(jsondata2))
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}

slice := make([]uint64, 2)
Expand Down Expand Up @@ -221,8 +216,7 @@ func TestMethodSignature(t *testing.T) {
func TestMultiPack(t *testing.T) {
abi, err := JSON(strings.NewReader(jsondata2))
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}

sig := crypto.Keccak256([]byte("bar(uint32,uint16)"))[:4]
Expand All @@ -232,10 +226,8 @@ func TestMultiPack(t *testing.T) {

packed, err := abi.Pack("bar", uint32(10), uint16(11))
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}

if !bytes.Equal(packed, sig) {
t.Errorf("expected %x got %x", sig, packed)
}
Expand All @@ -246,11 +238,11 @@ func ExampleJSON() {

abi, err := JSON(strings.NewReader(definition))
if err != nil {
log.Fatalln(err)
panic(err)
}
out, err := abi.Pack("isBar", common.HexToAddress("01"))
if err != nil {
log.Fatalln(err)
panic(err)
}

fmt.Printf("%x\n", out)
Expand Down
17 changes: 6 additions & 11 deletions core/types/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,15 @@ func TestRecipientEmpty(t *testing.T) {
_, addr := defaultTestKey()
tx, err := decodeTx(common.Hex2Bytes("f8498080808080011ca09b16de9d5bdee2cf56c28d16275a4da68cd30273e2525f3959f5d62557489921a0372ebd8fb3345f7db7b5a86d42e24d36e983e259b0664ceb8c227ec9af572f3d"))
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}

from, err := Sender(HomesteadSigner{}, tx)
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}
if addr != from {
t.Error("derived address doesn't match")
t.Fatal("derived address doesn't match")
}
}

Expand All @@ -108,18 +106,15 @@ func TestRecipientNormal(t *testing.T) {

tx, err := decodeTx(common.Hex2Bytes("f85d80808094000000000000000000000000000000000000000080011ca0527c0d8f5c63f7b9f41324a7c8a563ee1190bcbf0dac8ab446291bdbf32f5c79a0552c4ef0a09a04395074dab9ed34d3fbfb843c2f2546cc30fe89ec143ca94ca6"))
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}

from, err := Sender(HomesteadSigner{}, tx)
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}

if addr != from {
t.Error("derived address doesn't match")
t.Fatal("derived address doesn't match")
}
}

Expand Down
Loading