signer: replace fmt.Printf to t.Logf in tests

This commit is contained in:
Shitaibin 2019-06-05 12:31:13 +08:00
parent 646746498e
commit a83becaec3
2 changed files with 6 additions and 6 deletions

View file

@ -178,7 +178,7 @@ func TestSignTxRequest(t *testing.T) {
t.Error(err) t.Error(err)
return return
} }
fmt.Printf("to %v", to.Address().String()) t.Logf("to %v", to.Address().String())
resp, err := r.ApproveTx(&core.SignTxRequest{ resp, err := r.ApproveTx(&core.SignTxRequest{
Transaction: core.SendTxArgs{ Transaction: core.SendTxArgs{
From: *from, From: *from,
@ -294,7 +294,7 @@ func TestMissingFunc(t *testing.T) {
if approved { if approved {
t.Errorf("Expected missing method to cause non-approval") t.Errorf("Expected missing method to cause non-approval")
} }
fmt.Printf("Err %v", err) t.Logf("Err %v", err)
} }
func TestStorage(t *testing.T) { func TestStorage(t *testing.T) {
@ -347,7 +347,7 @@ func TestStorage(t *testing.T) {
if retval != exp { if retval != exp {
t.Errorf("Unexpected data, expected '%v', got '%v'", exp, retval) t.Errorf("Unexpected data, expected '%v', got '%v'", exp, retval)
} }
fmt.Printf("Err %v", err) t.Logf("Err %v", err)
} }
@ -605,7 +605,7 @@ function ApproveSignData(r){
hash, rawdata := accounts.TextAndHash([]byte(message)) hash, rawdata := accounts.TextAndHash([]byte(message))
addr, _ := mixAddr("0x694267f14675d7e1b9494fd8d72fefe1755710fa") 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{ nvt := []*core.NameValueType{
{ {

View file

@ -38,13 +38,13 @@ func TestEncryption(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) 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) p, err := decrypt(key, iv, c, nil)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
fmt.Printf("Plaintext %v\n", string(p)) t.Logf("Plaintext %v\n", string(p))
if !bytes.Equal(plaintext, p) { if !bytes.Equal(plaintext, p) {
t.Errorf("Failed: expected plaintext recovery, got %v expected %v", string(plaintext), string(p)) t.Errorf("Failed: expected plaintext recovery, got %v expected %v", string(plaintext), string(p))
} }