all: replace fmt.Print* calls with t.Log* in tests (#19670)
This commit is contained in:
@ -321,11 +321,11 @@ func TestFormatter(t *testing.T) {
|
||||
}
|
||||
formatted, _ := d.Format()
|
||||
for _, item := range formatted {
|
||||
fmt.Printf("'%v'\n", item.Pprint(0))
|
||||
t.Logf("'%v'\n", item.Pprint(0))
|
||||
}
|
||||
|
||||
j, _ := json.Marshal(formatted)
|
||||
fmt.Printf("'%v'\n", string(j))
|
||||
t.Logf("'%v'\n", string(j))
|
||||
}
|
||||
|
||||
func sign(typedData core.TypedData) ([]byte, []byte, error) {
|
||||
@ -364,7 +364,7 @@ func TestJsonFiles(t *testing.T) {
|
||||
continue
|
||||
}
|
||||
_, _, err = sign(typedData)
|
||||
fmt.Printf("Error %v\n", err)
|
||||
t.Logf("Error %v\n", err)
|
||||
if err != nil && !expectedFailure {
|
||||
t.Errorf("Test %d failed, file %v: %v", i, fInfo.Name(), err)
|
||||
}
|
||||
@ -397,11 +397,11 @@ func TestFuzzerFiles(t *testing.T) {
|
||||
}
|
||||
_, err = typedData.EncodeData("EIP712Domain", typedData.Domain.Map(), 1)
|
||||
if verbose && err != nil {
|
||||
fmt.Printf("%d, EncodeData[1] err: %v\n", i, err)
|
||||
t.Logf("%d, EncodeData[1] err: %v\n", i, err)
|
||||
}
|
||||
_, err = typedData.EncodeData(typedData.PrimaryType, typedData.Message, 1)
|
||||
if verbose && err != nil {
|
||||
fmt.Printf("%d, EncodeData[2] err: %v\n", i, err)
|
||||
t.Logf("%d, EncodeData[2] err: %v\n", i, err)
|
||||
}
|
||||
typedData.Format()
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ func TestSignTxRequest(t *testing.T) {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
fmt.Printf("to %v", to.Address().String())
|
||||
t.Logf("to %v", to.Address().String())
|
||||
resp, err := r.ApproveTx(&core.SignTxRequest{
|
||||
Transaction: core.SendTxArgs{
|
||||
From: *from,
|
||||
@ -294,7 +294,7 @@ func TestMissingFunc(t *testing.T) {
|
||||
if approved {
|
||||
t.Errorf("Expected missing method to cause non-approval")
|
||||
}
|
||||
fmt.Printf("Err %v", err)
|
||||
t.Logf("Err %v", err)
|
||||
|
||||
}
|
||||
func TestStorage(t *testing.T) {
|
||||
@ -346,7 +346,7 @@ func TestStorage(t *testing.T) {
|
||||
if retval != exp {
|
||||
t.Errorf("Unexpected data, expected '%v', got '%v'", exp, retval)
|
||||
}
|
||||
fmt.Printf("Err %v", err)
|
||||
t.Logf("Err %v", err)
|
||||
|
||||
}
|
||||
|
||||
@ -602,7 +602,7 @@ function ApproveSignData(r){
|
||||
hash, rawdata := accounts.TextAndHash([]byte(message))
|
||||
addr, _ := mixAddr("0x694267f14675d7e1b9494fd8d72fefe1755710fa")
|
||||
|
||||
fmt.Printf("address %v %v\n", addr.String(), addr.Original())
|
||||
t.Logf("address %v %v\n", addr.String(), addr.Original())
|
||||
|
||||
nvt := []*core.NameValueType{
|
||||
{
|
||||
|
@ -38,13 +38,13 @@ func TestEncryption(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
fmt.Printf("Ciphertext %x, nonce %x\n", c, iv)
|
||||
t.Logf("Ciphertext %x, nonce %x\n", c, iv)
|
||||
|
||||
p, err := decrypt(key, iv, c, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
fmt.Printf("Plaintext %v\n", string(p))
|
||||
t.Logf("Plaintext %v\n", string(p))
|
||||
if !bytes.Equal(plaintext, p) {
|
||||
t.Errorf("Failed: expected plaintext recovery, got %v expected %v", string(plaintext), string(p))
|
||||
}
|
||||
|
Reference in New Issue
Block a user